Skip to content
Logo

Conformance

@ghostry/harness/conformance registers a suite that checks your runner behaves the way harness needs. Compatibility becomes something you test in your own setup, at your runner's version, not a list of runners that happened to work.

// test/conformance.test.ts
import { conformance } from "@ghostry/harness/conformance";
import * as framework from "bun:test";
 
conformance(framework);

Put it in a test file of its own. It sets up its own initialize with its own test integrations and registers everything under one describe, so it doesn't touch your setup. It waits only on promises, never on timers, so it works with fake timers installed.

A failed check fails a test with ConformanceError, which states the guarantee, what harness needs, and what the runner did.

What it checks

  • A nested describe reaches the test with its full path.
  • The runner finishes collecting a describe before running its tests.
  • Hooks and integration teardown run in order around the test.
  • No test starts before the previous one settles.
  • beforeAll and afterAll run before and after their suite, when the runner has them.
  • The runner waits for a test's promise. This is checked with a test that rejects, declared with it.failing (bun, jest) or it.fails (vitest, rstest), so the suite only passes if the rejection reached the runner as a failure. mocha and node:test have neither, so there the check is skipped with a message saying so.

What it doesn't check

  • An async describe, which runners legitimately handle differently. See Async describe.
  • Where a synchronous failure is reported, which no test can see from inside the run.