Skip to main content

Dedication to quality

A testing library has to be more reliable than the code it tests. This page describes how WireMock Testcontainers for Node.js earns that: what is tested, how often, and to what standard.

Unit tests​

The library's unit tests run without Docker, so they are fast and run on every change. They cover the builder, registration and validation, extensions, JAR handling, the no-Docker runtime and the repository's own scripts. Coverage of src/ is collected in CI and enforced at 95 % for statements, branches, functions and lines – a pull request that drops below it fails.

The docs tooling – the plugins that embed snippets, check links and generate the API overview – is unit-tested too, at 100 % coverage.

Integration tests​

Mocks of a mock prove little, so every change also runs against a real WireMock container:

  • Library end-to-end tests start WireMock in Docker on Node.js 22 and 24 and exercise the public API over real HTTP.
  • The examples project consumes the built package through npm link, exactly as you would. Every example is type-checked, linted, unit-tested at 100 % coverage per file, and run end-to-end against WireMock.
  • The docs site is built and served, and every page, embedded snippet and docs link used anywhere in the repository – JSDoc, READMEs, examples – is checked to resolve, anchors included.

CI never uses --no-docker: Docker stays the source of truth.

Docs that cannot drift​

Every code snippet on this site is embedded from the examples project – hand-written TypeScript, JavaScript or JSON in a page fails the build. Every example links back to the page that shows it, every public API must be documented and used in an example, and a pull request that changes the library must update its docs or examples. See how it works and contributing to the docs.

Performance​

Integration tests are only useful if people run them, so the library is designed to keep them fast:

  • One container per suite. reset() restores stubs, scenarios and the request journal between tests in milliseconds, instead of restarting WireMock.
  • Fail before Docker. Registrations are validated when they are made, and start() checks extensions and options before starting anything – mistakes surface in a unit test, not minutes later.
  • One runtime dependency. testcontainers is the only dependency; the package is tree-shakeable and ships ESM and CJS.
  • No Docker for local development. A local WireMock JVM can serve every container when Docker is unavailable.

Accessibility​

These docs are built with Docusaurus: semantic HTML, a skip-to-content link, keyboard-navigable menus, and a dark theme by default with a light theme one click away. The brand colours are adjusted per theme – links in dark mode use a lighter pink so they stay readable on the navy background – and images carry alternative text.

Coverage at a glance​

Each block of the sunburst is a directory or file of src/, sized by its number of lines and coloured by its coverage. The graph updates with every push to main; open the full report on Codecov for line-by-line detail.

Sunburst graph of test coverage of the library's source, by directory and file