Skip to content
Playground(another site)

bynk.observe.trace_outside_test

Error trace(Cap.op) appears outside a case body.

trace(Cap.op) reads the calls a test has recorded through a capability. Only a test records them, so it is allowed only in a case body, never in a service, an agent or a function. Remove it from the code under test and read the trace in the test, or observe the call with expect Cap.op called.

Example

demo/pay.bynk
let calls = trace(Logger.log) // ✗ in the service
// tests/t.test.bynk
expect trace(Logger.log).length() == 1 // ✓ in a case

In the Book

See also

  • Every code in its category, Observation, on the diagnostic index.
  • bynk explain bynk.observe.trace_outside_test shows the same from the installed toolchain, without a network.