tst

βŽ‡

Minimal test runner β€” open DevTools console to see results

Options

Default ?mute ?bail ?grep=async ?format=tap

πŸ’‘ URL params: ?grep=pattern ?mute ?bail ?format=tap
πŸ’‘ Node env: TST_GREP=pattern TST_MUTE=1 TST_BAIL=1 TST_FORMAT=tap

Assertions

  • ok(value) β€” value is truthy
  • is(a, b) β€” a equals b (deep)
  • not(a, b) β€” a differs from b
  • same(a, b) β€” arrays have same items
  • any(val, list) β€” value is in list
  • throws(fn, match?) β€” function throws
  • rejects(fn, match?) β€” async fn rejects
  • almost(a, b, eps?) β€” floats are close

Modifiers

  • test(name, t => {}) β€” define a test
  • test.skip(name, t => {}) β€” skip this test
  • test.only(name, t => {}) β€” run exclusively
  • test.todo(name, t?) β€” mark as planned
  • test.mute(name, t => {}) β€” suppress output
  • test.demo(name, t => {}) β€” ignore failures
  • test.fork(name, t => {}) β€” run in worker
  • test.run({ timeout, ... }) β€” manually run