uvu is an extremely fast and lightweight test runner designed for both Node.js and browser environments, currently stable at version 0.5.6. It features a minimalist API, supporting `async`/`await` tests and native ES Modules. While `uvu` ships with its own optional assertion library (`uvu/assert`), it is entirely compatible with any assertion library that throws standard JavaScript Errors for failures. It differentiates itself by its focus on performance, minimal footprint, and flexibility in choosing assertion methods, making it a strong contender for projects prioritizing speed and small bundle sizes. Releases are typically patch-based, addressing bugs and improving compatibility, with major feature additions occurring less frequently.
npm install uvuVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates basic test definition with `uvu` and shows how to use its built-in `uvu/assert` module for various assertions, including `is`, `snapshot`, and `equal`.
Review tests that interact with the `suite` context. Ensure any modifications to the context within test handlers are intentional and do not create unintended side effects across tests. If immutability is desired for specific values, clone them explicitly.
For new projects, configure `package.json` with `"type": "module"` and use `import`/`export`. For mixed or older projects, ensure Node.js is recent enough (>=12 for full native ESM support without flags) or use the `-r esm` flag explicitly when running tests.
Review tests for `process.exit()` calls within test bodies; these should be removed or mocked if testing exit behavior. Identify and ensure all Promises are properly handled and resolved/rejected within asynchronous tests to prevent unhandled rejections from failing the test suite.
Always include `test.run();` as the last statement in your test file to initiate the test execution process. For modularized test files that are imported by a runner, ensure the runner handles the execution.
Ensure your `package.json` has `"type": "module"` if you intend to write ES Modules, or use the `--require esm` flag with Node.js or `uvu` CLI: `node -r esm your-test.js` or `uvu -r esm tests/`.
For `test` and `suite`, use named imports: `import { test, suite } from 'uvu';`. For `uvu/assert`, use `import * as assert from 'uvu/assert';` and then call methods like `assert.is()`.Add `import * as assert from 'uvu/assert';` at the top of your test file where `assert` is needed.
No dependency data recorded yet.