Skip to content
Playground(another site)

bynk.test.snapshot_name_not_literal

Error matches snapshot is not followed by a string literal; a snapshot is named by a literal so the compiler knows every snapshot a suite takes.

A snapshot is stored under its name, so the name must be a string literal: the compiler then knows every snapshot a suite takes. A variable or other expression is refused. Write the name as a literal.

Example

expect read("a") matches snapshot name // ✗ not a string literal
expect read("a") matches snapshot "first" // ✓

In the Book

See also

  • The grammar rule it governs: snapshot_expr.
  • Every code in its category, Tests, on the diagnostic index.
  • bynk explain bynk.test.snapshot_name_not_literal shows the same from the installed toolchain, without a network.