This is the first (pre)release of AVA 4 🎊 There's some great new features, some cleanup of old interfaces, and some other smaller-but-still-breaking changes.
You can install the latest AVA 4 prerelease using:
npm install -D -E ava@next
The cool new stuff
Worker threads 🧑💼
By default, test files are now run in worker threads! Huge thanks to @dnlup for landing this. 0e5cc7d
Test files should run a little quicker, since it's easier to spin up a worker thread than a child process. You can use --no-worker-threads
on the command line, or workerThreads: false
in your AVA configuration, to fall back to using child processes.
New snapshot format 📸
@ninevra has worked tirelessly on landing a new snapshot format. It contains all information necessary to regenerate the report file. This allows for snapshots to be updated even if tests or assertions are skipped. 14ec281
Asynchronous config loading & ESM support 🤾
AVA's configuration files may now export promises or asynchronous factory methods. The ava.config.js
file is now treated as CJS or ESM depending on module type configured in the package.json
file. ava.config.mjs
is now supported. f7cb1c7 c7b7820
Previously failing test files run first 🏃
AVA now records which test files failed in the previous run. It then prioritizes testing these files when you run AVA again. Thanks @bunysae! d742672
Assertions as type guards 💂
Most assertions now return a boolean indicating whether they passed. If you use AVA with TypeScript, you can use this as a type guard. Thanks @jmarkham828! 72a4e2f 5eea608
(This is not supported for t.snapshot()
and the "throws" assertions.)
The breaking changes 💥
- AVA 4 requires Node.js 12.20, 14.15 or 15. Node.js 10 is no longer supported 5dd22c9
- By default test files execute in worker threads, not child processes 0e5cc7d
ava.config.js
now follows the module type configured inpackage.json
f7cb1c7 c7b7820- Snapshots recorded using earlier AVA versions are no longer recognized. Run
npx ava -u
to rebuild your snapshots after upgrading 14ec281 - Snapshots no longer recognize React elements, instead we want to provide this functionality through a plugin interface 26999c4
t.snapshot()
no longer works in hooks bcb750ct.snapshot()
no longer takes an options argument allowing you to customize the snapshot ID d8b1e89test.cb()
andt.end()
have been removed. Use async functions andutil.promisify()
instead.- The
t.throws()
andt.throwAsync()
assertions can no longer be called with anull
value for the expectations argument 7f64f5c t.teardown()
now executes in last-in-first-out order dc4483f- Support for the
esm
package has been removed 2011b92 - Our TypeScript definitions are now tested against TypeScript 4.2 6429581 9cedc97
- A whole host of experimental features have become default, and can no longer be opted into.
Other changes 🗒
Our TypeScript recipe has been updated with ts-node
and ESM instructions. Thanks @mesqueeb! a079152
We'd also like to thank @kiancross, @papb and @jerrygreen.