Testing strategy

Test the contract at every edge.

The shared protocol suite uses vanilla-test and executes the same untransformed module in Node.js and real Chrome coverage.

Shared vanilla-test suite

AreaEvidence
ExportsRoot default, root named, and legacy Message.js resolve to one class.
StateFresh defaults, enumerability, instance isolation, and recovery.
SerializationExact two-key JSON, toJSON(), extras exclusion, and native failure semantics.
LoadingJSON strings, object input, nested values, malformed JSON, and invalid shapes.
Browser globalString/object loading, errors, and JSON parity with the ES module.

The protocol module records 12 focused checks. Separate documentation and local-server suites treat pages, metadata, local links, package exports, security boundaries, workflows, and the generated header as tested repository contracts.

Local commands

npm ci
npm test
npm run coverage:node
npm run coverage:chrome
npm start

Development and coverage use Node.js 22.12 or newer because vanilla-test v2 targets current Web-standard runtimes. The shipped js-message module retains its existing Node.js 13.2 engine floor and has a dependency-free compatibility smoke.

Coverage and delivery gates

  • Node and Chrome independently require 100% statements, branches, functions, and lines across the shipped modules.
  • Linux, macOS, and Windows run the package suite on current Node releases.
  • Legacy-compatible Node versions execute the dependency-free package smoke.
  • npm pack is inspected and installed in a clean temporary project before delivery.
  • GitHub Pages receives an explicit allowlist only after required test jobs pass.
Published code is the test target.

The root package import, both supported deep paths, and the browser-global file are verified directly—no generated build stands between the tests and npm files.