This package, `test`, provides a user-land backport of the experimental `node:test` module, originally introduced in Node.js 18. It allows developers to utilize the same standardized testing API in Node.js environments from version 14 and later. The current stable version is 3.3.0, released in early 2023, with subsequent maintenance releases as needed. The project maintains a feature-driven release cadence, closely mirroring updates and enhancements in the core `node:test` module. Its key differentiators include minimal runtime dependencies, a comprehensive test suite to ensure robust compatibility with Node.js core, and the crucial ability to introduce modern `node:test` capabilities to older Node.js versions without requiring core upgrades. Unlike the core implementation, it does not hide its own stack frames, offering slightly different debugging clarity.
npm install testVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic synchronous, asynchronous (Promise and callback), and subtest creation, including a skipped test, using the `test` API.
Update any direct GitHub repository references to `https://github.com/nodejs/node-core-test`.
Pass `NODE_OPTIONS='--experimental-abortcontroller'` in your environment when running tests on Node.js v14.x. For v14.x, consider adding `--no-warnings` to suppress experimental feature warnings.
Always `await` calls to `t.test()` when defining subtests within an `async` parent test function.
Upgrade to v3.2.1 or newer to ensure the test runner works reliably across various `AbortSignal` support levels. For Node.js v14.x, continue to use `--experimental-abortcontroller` for full functionality.
Ensure all calls to `t.test()` within an `async` parent test function are `await`ed, e.g., `await t.test('my subtest', ...)`.For ESM, use `import test from 'test'`. For CommonJS, use `const test = require('test')`. Ensure your bundler configuration correctly handles module interop. If the issue persists, try `import * as testModule from 'test'; testModule.default('my test', ...);`.Review the asynchronous operations within the test to ensure they complete. If the operation is genuinely long-running, increase the test's timeout using the `{ timeout: milliseconds }` option in `test()`.No dependency data recorded yet.