Skip to content
Playground(another site)

bynk.test.snapshot_not_codable

Error The value of an expect … matches snapshot is not Codable: a snapshot stores the value's Json.encode text, so it must be in the domain Json.encode accepts.

A snapshot stores the value as the JSON text Json.encode produces, so the value must be Codable: base types, named types and the built-in containers over them. A Stream, a function, an Effect or () has no such text. Snapshot a Codable value instead, such as a list.

Example

expect Stream.of([1, 2]) matches snapshot "items" // ✗ a `Stream`
expect [1, 2] matches snapshot "items" // ✓ a `List[Int]`

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_not_codable shows the same from the installed toolchain, without a network.