Skip to content
Eugene Lazutkin edited this page Jun 27, 2026 · 2 revisions

Dashboard

Build status NPM version

tape-six-invariant is a zero-dependency library of assert-style invariant checks that materialize into real tape-six assertions when a tape-six run exercises the code, and are inert (or a configurable behavior) in production. It never imports tape-six — the two coordinate through the global slot Symbol.for('tape6.invariant.host.v1').

import check from 'tape-six-invariant';

export function transfer(from, to, amount) {
  check(amount > 0, 'amount must be positive');
  check(from.currency === to.currency, 'currencies must match');
}
  • Under a tape-six run, each check() becomes a counted assertion on the current test.
  • In production, the default is inert; configure it with setAbsentBehavior.

Pages

  • API — full reference: check, hasHost, setAbsentBehavior, canned behaviors, InvariantError.
  • Stripping checks in builds — remove check() from release bundles with a builder.

See the README for installation and a quick start.

Clone this wiki locally