ava
8.4.0 · 7 Nov 2026MIT575.3k / weekRepositoryHomepagenpmAtom feed
0.25.0 is the newest release of 0.15.x.
In short
13 new2 fixed
Release note
In this release we've added some very useful features we think you'll like. There are no known breaking changes. We have worked hard on fixing bugs and improving performance. Going forward stability and performance will be our top priority as we're progressing towards a stable release. Finally, we're delighted to welcome @sotojuan to the team! 🎉
Test file conventions
When you run AVA without any arguments, it tries to find your test files based on some conventions. The previous release had the following default patterns:
test.js test-*.js test/**/*.js
In this release we added additional default patterns based on community conventions:
test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js
This means AVA will now also run test files in __tests__ directories and test files ending in .test.js anywhere in your project.
Known failing tests
A big part of open source maintenance is triaging issues. This can be a tedious task, involving a lot of back and forth with the person reporting the issue. Submitting a PR with a failing test makes the whole process much more efficient. It helps maintainers by providing a quality reproduction, allowing them to focus on code over triaging. Users benefit as their bugs get fixed faster.
To make it easier to submit failing tests, we're introducing a new test modifier: test.failing(). These tests are run just like normal ones, but they are expected to fail, and will not break your build when they do. If a test marked as failing actually passes, the build will break with a helpful message instructing you to remove the .failing modifier.
test.failing('demonstrate some bug', t => {
t.fail(); // test will count as passed
});This allows you to merge .failing tests before a fix is implemented without breaking CI. It is also a great way to recognize good bug reports with a commit credit, even if the reporter is unable to fix the problem.
Test macros
Sometimes you want to run a series of very similar tests, each with different inputs and expected results. The traditional solution is to use test generator functions. However, this makes it difficult to perform static analysis on the tests, which is especially important for linting. In this release, we are introducing test macros as the official way to create reusable tests.
Test macros let you reuse test implementations. Additional arguments passed in the test declaration are forwarded to the macro:
function macro(t, input, expected) {
t.is(eval(input), expected);
}
test('2 + 2 === 4', macro, '2 + 2', 4);
test('2 * 3 === 6', macro, '2 * 3', 6);If you are generating lots of tests from a single macro, you may want to generate the test title programmatically:
macro.title = (providedTitle, input, expected) => {
return `${input} === ${expected}`
};Always modifiers for after and afterEach hooks
By default after and afterEach hooks will not be run if the preceding test fails. This is undesirable if the hooks contain cleanup code that you want run regardless. You can change that behavior using the .always chaining modifier.
test.after.always(t => {
// always runs at the end. Regardless of test pass/fail state.
});
test.afterEach.always(t => {
// always runs after each test. Regardless of test pass/fail state.
});Note that the --fail-fast switch will disable this behavior, and AVA will exit at the first encountered failure without waiting for the always hooks.
Limited concurrency [EXPERIMENTAL]
Concurrency is awesome! It's what makes AVA so fast. Our default behavior is to spin up an isolated process for every test file immediately, and then run all your tests. However, for users with lots of test files, this was eating up too many system resources, causing memory and IO thrashing. We are experimenting with an option to let you limit how many tests files AVA runs at the same time. If you have a lot of test files, try running AVA with the --concurrency flag. For example, run $ ava --concurrency=5 and see if the performance improves. Please let us know how it works for you! We need feedback on the feature.
Note: This is an experimental feature and might change or be removed in the future.
Highlights
Improve
t.deepEqual(). 973624dImprove watch logging. 95a5c97
Disable TAP-reporter in watch mode. 02b0aae
Throwing synchronously inside a callback-style test now fail it immediately. d6acdde
Detect improper use of
t.throws. 3201b1bProtect against bad argument passed to
t.throws. 60bd8a5Improve
power-assertoutput. 84c05feAdd spinner fallback for Windows. c4e58e3
Warn about
npm linkusage on Node.js 6. a543b9fRemember failures from previous tests in watch mode. aab2207
Fix crash in 'fake' browser environment. 0fa229e
Fix warning when no files are found. ee76aa9
Strip ANSI escape codes in the TAP output. 3c4babd
React recipe. 4c69c79
Italian translation of the docs. 195390e
All Changes
We’ve merged 92 commits from 23 contributors since 0.14.0. This only scratches the surface, as lots of additional work has gone into our linter, localized docs and countless other projects that make AVA possible. To everyone who’s reported bugs, contributed to design discussions, and filed PR’s with documentation or code - Thank You!
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.