Brittle is a lightweight, modern TAP (Test Anything Protocol) test runner for JavaScript, currently stable at version 3.19.1. It provides a clean API for writing both classic callback-based and modern async/await tests, supporting features like test plans, subtests, explicit exception/execution checks, and utilities for timeouts and teardowns. A key differentiator is its support for multiple JavaScript runtimes, including Node.js, Bare, and Pear, making it suitable for a wide range of environments. While a strict release cadence isn't published, it appears to be actively maintained with regular updates. Brittle aims to be a robust yet simple testing solution, focusing on developer experience and modern JavaScript paradigms without the overhead of larger test frameworks.
npm install brittleVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic synchronous and asynchronous tests, including assertions, plans, subtests, and the inverted test style.
Migrate your test files to use `import` statements (e.g., `import test from 'brittle'`). Ensure your `package.json` specifies `"type": "module"` or use a `.mjs` file extension for your test files.
For inverted tests, always define `t.plan(count)` at the beginning if you know the number of assertions, or explicitly call `t.end()` at the end of the test function if the number of assertions is dynamic or unknown.
Always `await` promises returned by asynchronous functions within your tests. For inverted tests, `await t` will only resolve once `t.plan` is fulfilled or `t.end()` is called, ensuring that the main test runner waits for the inverted test's completion.
Update your module syntax to use `import test from 'brittle'` and ensure your Node.js environment is configured for ESM (e.g., `"type": "module"` in `package.json` or `.mjs` file extension).
Ensure `import test from 'brittle'` or `import { test } from 'brittle'` is present at the top of your test file.For inverted tests, add `t.plan(N)` to declare the expected number of assertions, or call `t.end()` when the test has completed its work.
No dependency data recorded yet.