Evidence vanilla-test 2.1.0
Testing & coverage
The public API is exercised as JavaScript through the author’s own vanilla-test module, then measured without transforming node-cmd source.
vanilla-test owns the suite and coverage command
vanilla-test@2.1.0 is node-cmd’s only direct development dependency. Its dependency graph contains only the author’s ansi-colors-es6 and strong-type modules. The shipped package declares no runtime dependencies, and npm does not install the test tool for node-cmd consumers.
{
"scripts": {
"test": "node ./test/node.mjs",
"test:unit": "node ./test/node.mjs unit",
"test:functional": "node ./test/node.mjs functional",
"test:behavioral": "node ./test/node.mjs behavioral",
"test:integration": "node ./test/node.mjs integration",
"test:regression": "node ./test/node.mjs regression",
"test:runtime-contract": "node ./scripts/validate-runtime-contract.js",
"coverage": "vanilla-test coverage node",
"verify": "npm test && npm run coverage && npm run test:runtime-contract && npm run test:package && npm run site:check"
},
"devDependencies": {
"vanilla-test": "2.1.0"
}
}
The suite uses VanillaTest for case lifecycle and reporting. Node’s built-in node:assert/strict supplies precise deep equality, rejection, and pattern assertions; no separate assertion framework is installed.
node:child_process. Runtime-dependency conflict testing is likewise not applicable because the package has zero runtime dependencies.Per-file native Node coverage gates
vanilla-test coverage node executes the same suite under native V8 coverage and publishes text, HTML, LCOV, and JSON summary reports. Both shipped entry points are included.
{
"entry": "./test/api.test.js",
"thresholds": {
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
},
"node": {
"include": ["cmd.js", "cmd.mjs"]
}
}
| Source | Statements | Branches | Functions | Lines |
|---|---|---|---|---|
| All shipped source | 100% | 100% | 100% | 100% |
cmd.js | 100% | 100% | 100% | 100% |
cmd.mjs | 100% | 100% | 100% | 100% |
coverage/node/index.html, lcov.info, coverage-summary.json, and a normalized ANSI-free test-results.json. CI publishes the same HTML tree at this site’s coverage report, exposes the machine-readable test results, and retains the complete directory as a workflow artifact.53 focused cases across five independently runnable sets
The original 48 cases keep narrow assertion boundaries. Five black-box Behavioral scenarios add composed and temporal consumer outcomes without changing the runtime implementation or duplicating CI matrix runs.
| Set | Cases | Primary contract | Run alone |
|---|---|---|---|
| Unit | 5 | CommonJS and ESM surface plus compatibility aliases | npm run test:unit |
| Functional | 17 | Normal callback, Promise, sync, direct-file, and stream behavior | npm run test:functional |
| Behavioral | 5 | Shell composition, failure output, buffer limits, timeouts, and live output | npm run test:behavioral |
| Integration | 8 | Process I/O, environment, cancellation, isolation, and literal arguments | npm run test:integration |
| Regression | 18 | Overloads, omitted values, buffers, validation, and error normalization | npm run test:regression |
| Total | 53 | Public execution paths, compatibility edges, and consumer workflows | npm test |
- Unit: exact CommonJS exports, both Promise aliases, ESM default identity, and ESM named-export identity.
- Functional: successful and failing shell/direct calls, callbacks, Promises, sync envelopes, buffers, process handles, and live streams.
- Behavioral: shell command chaining, partial callback output, max-buffer rejection, direct-process timeout, and output observed before stream exit.
- Integration: cwd and environment forwarding, interactive stdin, AbortSignal, parent stderr isolation, literal argv, encoding, and explicit stdio.
- Regression: callback/options overloads, null and undefined arguments, safe sync defaults, captured buffer failures, validation, and non-Error failures.
Minimum runtime, current LTS, and three operating systems
| Operating system | Node 22.12 | Node 24 | Purpose |
|---|---|---|---|
| Ubuntu | Full suite | Full suite | Unix shell/process behavior |
| macOS | Full suite | Full suite | Darwin process behavior |
| Windows | Full suite | Full suite | ComSpec, quoting, and Windows process behavior |
A separate Node 24 job enforces coverage. A package-smoke job creates the npm tarball, installs it into a clean temporary consumer, verifies bare CommonJS and Node.js ESM imports, confirms version 6.0.1 and the exact shipped files, and proves that development tooling is not installed for consumers.
Run the same gates locally
npm ci
npm test
npm run test:unit
npm run test:functional
npm run test:behavioral
npm run test:integration
npm run test:regression
npm run test:runtime-contract
npm run coverage
npm run test:package
npm run site:check
# everything in release order
npm run verify
npm test- Runs all 53 cases once through
vanilla-test. npm run test:*- Runs Unit, Functional, Behavioral, Integration, or Regression independently while debugging.
npm run coverage- Runs all five sets under the configured Node coverage thresholds.
npm run test:package- Tests what npm consumers actually receive, not the repository worktree.
npm run site:check- Checks every documentation page, local link, shared asset, and client script.
Any failed case or gate stops delivery
vanilla-test returns a structured result with ok and failureCount; the Node adapter maps it to the process exit code. Coverage thresholds, package smoke, and site validation also return nonzero on failure. GitHub Pages only assembles and deploys after tests, coverage, and package verification have all passed.