Releases: avajs/ava
1.0.0-rc.1
Release Candidate One 🥁
With this release AVA supports babel.config.js
files. We've also improved our cache invalidation when you change your Babel configuration, so we're just about ready to ship the final 1.0 release 🎉
Please give this release a try and let us know of any problems. And as always with pre-releases, be sure to install an exact dependency. There may still be breaking changes between now and the 1.0 release:
$ npm install --save-dev --save-exact ava@next
Please see the release notes for the previous betas:
Highlights
babel.config.js
support. ff09749 We're still looking for some help with updating the documentation, see #1816.- Improved Babel cache invalidation. ff55236
- AVA now prints pending tests when timeouts occur, when using
--verbose
. 6d12abf
Deep-equal and (breaking) snapshot changes
We now support BigInt
and <React.Fragment>
in t.deepEqual()
and t.snapshot()
. We've also improved support for the Symbol.asyncIterator
well-known symbol. Unfortunately these changes are not backwards compatible. You'll need to update your snapshots when upgrading to this release. 71eede7
Bug fixes and other improvements
profile.js
now handlesextensions
configuration. 30a80b6- When using
t.throws()
with asynchronous functions, AVA now suggests you uset.throwsAsync()
instead. f125b4d - AVA now detects when you attempt to wrap
ava.config.js
configuration in anava
property. f93b341
All changes 📚
Thanks 💌
💖 Huge thanks to @grant37, @xxczaki, @jamiebuilds, @robertbernardbrown, @lo1tuma, @goooseman, @wmik and @vancouverwill for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.8
Beta Eight 🖐🤞☝️
We're getting ever closer! As you may recall our 1.0 release has been in beta due to its dependency on Babel 7. Well, Babel 7.0.0 has shipped! Lots of hurrahs and love to the Babel team for getting to this milestone. You should go read their announcement post 🎊
With this beta AVA now supports Babel 7. Before we can ship our 1.0 release there's just two issues left to tackle:
- We need to make sure AVA works with
babel.config.js
files and update our documentation: #1816 - We need to improve our cache invalidation when you change your Babel configuration: #1817
If you'd like to help get the 1.0 release over the line, please give us a shout in the respective issues.
Meanwhile, despite the release saying Beta, you really should be using this version. There won't be any fixes for the 0.x
releases. Just be sure to install an exact dependency, as SemVer doesn't really apply to these betas:
$ npm install --save-dev --save-exact ava@next
Please see the release notes for the previous betas:
Highlights
Babel 7.0.0!
Also, the code
expectation in t.throws()
and t.throwsAsync()
may now be a number. 7f974cc
Bug fixes
- TTY support for
process.stderr
is now emulated in the worker processes. 99098cc profile.js
once again works with snapshots. 846920a- Missing
test.serial.failing.only()
andtest.serial.failing.skip()
implementations have been added. 0ecd0be - Snapshots are now consistent across operating systems. If you've previously generated snapshots on Windows, you should update them using this release. 28fe4e8
- AVA is better at detecting whether it's Babel syntax plugins have already been included by the user. d3bfb73
- The default reporter now includes files that did not declare any tests in its final output. 40be597
All changes 📚
Thanks 💌
💖 Huge thanks to @jagoda, @okyantoro, @sharkykh, @Phrynobatrachus and @billyjanitsch for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.7
Beta Seven 🖐🤞
We're getting really close now! As you may recall our 1.0 release has been in beta due to its dependency on Babel 7. Well, Babel 7 now has a release candidate! 🎉
AVA now supports Babel 7.0.0-rc.1. Before we can ship our 1.0 release there's just two issues left to tackle:
- We need to make sure AVA works with
babel.config.js
files and update our documentation: #1816 - We need to improve our cache invalidation when you change your Babel configuration: #1817
If you'd like to help get the 1.0 release over the line, please give us a shout in the respective issues.
Meanwhile, despite the release saying Beta, you really should be using this version. There won't be any fixes for the 0.x
releases. Just be sure to install an exact dependency, as SemVer doesn't really apply to these betas:
$ npm install --save-dev --save-exact ava@next
Please see the release notes for the previous betas:
Highlights
Automatic spreading of test file runs across parallel CI jobs
AVA now automatically detects whether your CI environment supports parallel builds. Each build will run a subset of all test files, while still making sure all tests get executed. See the ci-parallel-vars
package for a list of supported CI environments. c4f607c
Breaking changes
Asynchronous use of the t.throws()
and t.notThrows
assertions
Before this release, the t.throws()
and t.notThrows()
assertions supported promises and observables. AVA did require you to await
calls to these assertions if you used them asynchronously (as of v0.19.0). We realized this behavior was both hard to explain and hard to express in Flow and TypeScript.
Therefore we've decided to make t.throws()
and t.notThrows()
work solely with synchronous exceptions. The new t.throwsAsync()
and t.notThrowsAsync()
assertions work with asynchronous assertions. To further simplify the implementation (and type definitions) we've removed support for observables. d5dd981 7babf6b
Generally speaking, you should be able to replace every occurence of await t.throws
with await t.throwsAsync
, and await t.notThrows
with await t.notThrowsAsync
. A transform file for jscodeshift is available in this Gist. Run it like:
$ npx jscodeshift -t https://gist.githubusercontent.com/novemberborn/c2cdc94020083a1cafe3f41e8276f983/raw/eaa64c55dfcda8006fc760054055372bb3109d1c/transform.js test.js
Change test.js
to a glob pattern that matches your test files. See the jscodeshift CLI usage documentation for further details.
test
export
We're no longer exporting the test()
method as a named export. Where before you could use import {test} from 'ava'
, you should now write import test from 'ava'
. d7c6b3d
Generator functions
We've dropped support for using generator functions as test implementations. This was a remnant of the dark days before async
/await
support. 02d768f
Dropped support for Node.js 9
Node.js 9 is no longer supported by Node.js itself. Per our support statement we're also dropping support in AVA. We're listing this here as a breaking change, but note that, in the future, we reserve the right to drop support for odd-numbered Node.js versions without bumping AVA's major version number. 359e14b
Bug fixes
- Adding new snapshots no longer causes the Markdown files to become malformed. 223f992
- User's
esm
settings no longer affect how we load theava.config.js
file. 6b6aa06 PromiseLike
typing in Flow has been improved. e0f914a- AVA now detects when it's required from a Node.js REPL. 3ac2a8f
- Better colors for use on light terminal themes. 76a8ce8
- The
assert
module in Node.js 10 no longer crashes. 55e4021 - Source maps, generated by AVA when compiling test & helper files, now contain correct paths to the source files. c9361cb
- Watch mode now detects changes to test & helper files with custom extensions. 17a18de
All changes 📚
Thanks 💌
💖 Huge thanks to @CanRau, @coreyfarrell, @ivanschwarz, @jagoda, @jamiebuilds, @padmaia, @ronen and @sh7dm for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.6
Beta Six 🖐☝️
A quick release to fix some issues with Beta 5, and to upgrade to [email protected]
. Please see the release notes for the previous betas:
Bug fixes
- Custom extension support now works without having to disable the Babel pipeline b3f7a70
- The mini reporter is no longer selected if your terminal does not support it 09f2d87
Enhancements
- Error messages now link to the documentation appropriate for the version of AVA you're using 9cdc29b
- AVA recognizes TypeScript build errors when using
ts-node/register
5cce79a - We've updated the TypeScript recipe with details on how to use it with our new custom extensions support 199cc70
All changes 📚
Thanks 💌
💖 Huge thanks to @tobil, @TheDancingCode and @btkostner for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.5.1
See Beta 5. This release fixes del
not being listed as a production dependency.
1.0.0-beta.5
Beta Five 🖐
It's time for another beta release for AVA 1.0. As you may recall we're now using Babel 7, so whilst Babel is in beta, so is AVA. You may want to read the previous release notes to get up to speed.
And despite the release saying Beta, you really should be using this version. There won't be any fixes for the 0.x
releases. Just be sure to install an exact dependency, as SemVer doesn't really apply to these betas:
$ npm install --save-dev --save-exact ava@next
Babel updates ✨ a5de369
AVA now supports [email protected]
. There've been significant changes to Babel's config resolution, both in beta 45 and in earlier releases. As you may be aware, AVA tries hard to detect when your Babel config changes, or when you update your plugins and presets. It's proven too difficult to maintain our existing code path for this. With this release we're using Babel's new APIs to construct AVA's Babel configuration, but unfortunately this has caused drastic regressions in our ability to invalidate AVA's precompilation cache.
For now, when you update your Babel config, plugins or presets, first reset AVA's cache. Luckily we've made this a lot easier:
$ npx ava --reset-cache
We have some ideas on how to detect most changes like we did before. Please join us in #1817 if you want to help.
Babel now supports babel.config.js
files. We're looking for help to update our documentation, add integration tests and ensure we use that configuration file by default. Come join #1816 to help out.
AVA now applies the ava/stage-4
preset last. If you're customizing or disabling the ava/stage-4
preset, you must do so in the testOptions
configuration. AVA now also supports Babel configurations that exclude specific files from compilation.
Configurable test & helper file extensions 🎈 3533aba
You can now tell AVA to run test files with extensions other than js
! For files that should be compiled using Babel you can specify babel.extensions
:
{
"ava": {
"babel": {
"extensions": ["js", "jsx"]
}
}
}
Or define generic extensions, e.g. for use with TypeScript:
{
"ava": {
"compileEnhancements": false,
"extensions": ["ts"],
"require": [
"ts-node/register"
]
}
}
Note that AVA still assumes test & helper files to be valid JavaScript. They're still precompiled to enable some AVA-specific enhancements. You can disable this behavior by specifying "compileEnhancements": false
.
Introducing ava.config.js
🍹 16f4742
You can now configure AVA through an ava.config.js
file. It must be placed next to the package.json
, and you mustn't have any "ava"
options in the package.json
file. Export the configuration as a default:
export default {
babel: {
extensions: ['js', 'jsx']
}
};
Or export a factory function:
export default ({projectDir}) => ({
babel: {
extensions: ['js', 'jsx']
}
});
Following our convention to use ES modules in test files, we're expecting ES modules to be used in the configuration file. If this is causing difficulties please let us know in #1820.
Optional catch
binding ⚾️ ad2d96d
The Optional catch
binding proposal just reached stage 4 in the TC39 process. You can use it in AVA today 🎉
try {
t.truthy(someFunc());
} catch { /* ignore */ }
t.throws()
supports a code
expectation 🍯 179f26a
Node.js' built-in errors come with a code
property. You can now easily test for them:
t.throws(() => {
fs.readFileSync('./example.txt');
}, {code: 'EACCES'});
Other breaking changes 💥
- Test implementations are now called with
null
as thethis
value. a681ecf - All reporters write to
stdout
. Thestdout
andstderr
output from workers is written toprocess.stderr
. AVA will insert linebreaks inprocess.stdout
after writing a chunk toprocess.stderr
that does not end in a line break. 57d180a - The
--no-cache
CLI flag has been replaced by a--reset-cache
command. The latter resets AVA's regular cache location. You can still disable the cache through thecache
configuration option. 8c9c474 ebb3948
Other changes 🚲
- AVA now uses its own Chalk instance, so AVA's color settings no longer impact the code you're testing. 2bd570e
- Error serialization has been made smarter, especially if non-Error errors are encountered. 0dc141d
- Uncaught exceptions and unhandled rejections are now shown with a code excerpt. 57d180a
- In watch mode, files being rerun are now excluded from the previous failure count. 57d180a
- You should see fewer repeated test timeout messages. d8349f5
- Better compatibility with recent Flow versions. a76d462
All changes 📚
Thanks 💌
💖 Huge thanks to @emilyschultz, @hallettj, @isnifer, @Jaden-Giordano, @good-idea and @jamiebuilds for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.4
A Spring release 🌸
Spring has come to those in the Northern Hemisphere, and to celebrate here's a new AVA release! It's the fourth beta release for AVA 1.0. You may want to read the previous release notes to get up to speed.
This release uses [email protected]
. We're waiting for Babel 7 to go out of beta before releasing the 1.0 version of AVA itself. This doesn't mean that these releases are any less stable than our previous 0.x
versions though! If your project itself doesn't use Babel, or if your tests aren't coupled to your use of Babel 6 you really should upgrade.
Both Babel's and AVA's beta releases can contain breaking changes that are not reflected in the version number. We're now pinning against the Babel beta releases, to avoid accidental updates. We recommend you do the same when installing this AVA beta release.
You can install this release using the next
distribution tag:
$ npm install --save-dev --save-exact ava@next
Goodbye Gitter, hello Spectrum 👋
We've moved the community to Spectrum. Come say hello!
Node.js 4 🌇
As you may be aware, Node.js 4 LTS will no longer be maintained come April 30th. Ordinarily this is when we'd drop support as well, but since we're in pre-release mode we decided to drop support a little early. See our Support Statement for our reasoning. e196257
npx
✨
Last July, npm started shipping npx
, an npm package runner. It's a great way of running both installed packages and running one-off commands without adding anything to your package.json
file.
Because of npx
we're no longer recommending you install AVA globally. Instead use npx ava
to run the AVA version installed in your project. d3bade8
We've also removed the ava --init
command. Instead run npx create-ava
to add AVA to your package.json
. 3311d69 319d079
Spring cleaning the assertions 🌼
We've removed the t.ifError()
assertion. It worked the same as t.falsy()
, so if you were using it please switch to t.falsy()
instead. e444654
Goodbye @std/esm
, hello esm
📦
The @std/esm
module loader has graduated to plain esm
. We've updated our integration as well. Huge congrats to the esm
team! 84a884e
Type definition improvements 🎭
We've made more improvements to the type definitions. You can once again pass an error to t.end()
without encountering type errors. Assertion skipping has also been brought in line with AVA's actual implementation. We've also added as much inline documentation as we could. ecc219a 53fb487
Documentation updates 📃
- We've included some examples of how to exclude test files using the glob syntax a510088
- The JSPM, webpack, React and Vue.js recipes have been updated for Babel 7 29d2c5d 04d88b5 a36422c 6bba766
- Examples in the TypeScript recipe has been updated to work in strict mode e9d417f
All changes 📚
Thanks 💌
💖 Huge thanks to @BusbyActual, @billyjanitsch, @Briantmorr, @jdalton, @malimichael, @martypdx, @clemtrek, @samuelli, @kugtong33 and @forresst for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.3
Continuing the work towards 1.0 🏗
This is the third beta release for AVA 1.0. You may want to read the release notes of the first beta, as well as the second one to get up to speed.
This release uses [email protected]
. We're waiting for Babel 7 to go out of beta before releasing the 1.0 version of AVA itself. This doesn't mean that these releases are any less stable than our previous 0.x
versions though! If your project itself doesn't use Babel, or if your tests aren't coupled to your use of Babel 6 you should really upgrade.
Install this release using the next
distribution tag:
$ npm install --save-dev ava@next
Many of our recipes are now out of date. There's a list of them in this issue. We'd love it if you could help us update these recipes.
Our ESLint plugin also needs some updates: avajs/eslint-plugin-ava#185, avajs/eslint-plugin-ava#186 & avajs/eslint-plugin-ava#187.
Changes
- Fix
--fail-fast
accidentally interrupting test runs (a6fb0a7) - Simplify our code coverage recipe (af2c2b6)
All changes 📚
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.2
Continuing the work towards 1.0 🏗
This is the second beta release for AVA 1.0. You may want to read the release notes of the first beta to get up to speed.
This release uses [email protected]
. We're waiting for Babel 7 to go out of beta before releasing the 1.0 version of AVA itself. This doesn't mean that these releases are any less stable than our previous 0.x
versions though! If your project itself doesn't use Babel, or if your tests aren't coupled to your use of Babel 6 you should really upgrade.
Install this release using the next
distribution tag:
$ npm install --save-dev ava@next
Many of our recipes are now out of date. There's a list of them in this issue. We'd love it if you could help us update these recipes.
Our ESLint plugin also needs some updates: avajs/eslint-plugin-ava#185, avajs/eslint-plugin-ava#186 & avajs/eslint-plugin-ava#187.
Breaking changes
New t.throws()
behavior
We've rewritten t.throws()
so it behaves better, has better error output and lets you write better tests (3c13c33):
- The assertion takes a first thrower argument. This can be a function — which should throw an exception, return a rejected promise or an erroring observable — or a rejected promise, or an erroring observable.
- The exception (or rejection reason, or observable error) must be an error object.
- The assertion returns the exception (through a promise if necessary).
You have a few ways of asserting that the exception is as designed. You can pass a second argument:
- If you pass a function it should be a constructor: the exception must be an instance of it. Previously you could pass a validation function. This is no longer possible.
- If you pass a string: the exception's
message
should be equal to it. - If you pass a regular expression: the exception's
message
should match it.
The most exciting new feature though is that you can pass an expectation object. A combination of the following expectations is supported:
t.throws(fn, {instanceOf: SyntaxError}) // err instanceof SyntaxError
t.throws(fn, {is: expectedErrorInstance}) // err === expectedErrorInstance
t.throws(fn, {message: 'expected error message'}) // err.message === 'expected error message'
t.throws(fn, {message: /expected error message/}) // /expected error message/.test(err.message)
t.throws(fn, {name: 'SyntaxError'}) // err.name === 'SyntaxError'
t.notThrows()
has also been updated but there aren't any breaking changes.
Modifier chaining
AVA's various test modifiers (.serial
, .skip
) must now be used in the correct order (7c0bf9b):
.serial
must be used at the beginning, e.g.test.serial()
.only
and.skip
must be used at the end, e.g.test.skip()
. You cannot combine them.failing
must be used at the end, but can be followed by.only
and.skip
, e.g.test.cb.failing()
andtest.cb.failing.only()
.always
can only be used after.after
and.afterEach
, e.g.test.after.always()
.todo()
is only available ontest
andtest.serial
. No further modifiers can be applied
Assertions can be skipped by using .skip
at the end of the assertion, e.g. t.deepEqual.skip()
(20f4cea). You can now safely skip snapshot tests, though not whilst updating snapshots.
New TypeScript and Flow definitions
The TypeScript and Flow definitions have been rewritten. The definitions export different interfaces so you may need to update your test code as well. The TypeScript recipe has been updated to reflect the changes, and there's a new Flow recipe as well (bac3c11, b2954a8).
Declaring tests
You must declare all tests and hooks at once. This was always the intent but previously AVA didn't enforce it very well. Now, once you declare a test or hook, all other tests and hooks must be declared synchronously. However you can perform some asynchronous actions before declaring your tests and hooks (963f5cf).
Serial hooks
Hooks declared using test.serial
will now execute serially. Only one of those hooks will run at a time. Other hooks run concurrently. Hooks still run in their declaration order.
Note that concurrent tests run concurrently. This means that .beforeEach()
and .afterEach()
hooks for those tests may also run concurrently, even if you use test.serial
to declare them.
Pass CLI flags to your tests
AVA now forwards arguments, provided after an --
argument terminator, to the worker processes (ac300c1). Arguments are available from process.argv[2]
onwards. There's a new recipe on how to use this.
Previously AVA populated process.argv[2]
and process.argv[3]
with some undocumented internal values. These are no longer available.
Internals
Some other internals have changed. You shouldn't have been relying on these, though if you did we're interested in hearing about it so we can better support your use case.
- The private
t._test
value has been removed - Some of the communication between the main process and the test workers has changed
- Access to the options object from inside a worker process has changed
Other changes
-
t.context
can now be used in.before
and.after
hooks (51a0ff0). -
--fail-fast
behavior has been improved. AVA now makes sure not to start new tests. Tests that are already running though will finish. Hooks will also be called. AVA now prints the number of skipped test files if an error occurs and--fail-fast
is enabled (f83f8c0, 8de2630, c1b418f). -
Assertion methods are now bound to the test, meaning you can provide them as direct arguments to other functions (20f4cea). A contrived example:
test('all are true', t => { getArray().forEach(t.true); });
Whilst not strictly assertions,
t.plan()
andt.log()
are now also pre-bound to the test. -
There's a new recipe on using ES modules (0b27db5)
-
We've also added a recipe on setting up tests (ae50a13)
All changes 📚
Thanks 💌
💖 Huge thanks to @jasonritchie, @forresst, @mdvorscak, @kugtong33 and @motss for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.
1.0.0-beta.1
1.0 (almost) 🏁
We've got some big news! With a gentle nudge from @razor-x we've decided to put up a 1.0 version. This will make it easier to push out patches and new features more regularly. We're also upgrading to Babel 7!
We're starting things off with a beta release. We'll keep the beta releases going until Babel 7 is out of beta itself. This version uses [email protected]
. If your use of AVA is coupled with your use of Babel 6 you'll have to stick with 0.25.0
.
Many of our recipes are now out of date. There's a list of them in this issue. We'd love it if you could help us update these recipes.
We've also taken this opportunity to land some long-discussed breaking changes. A few more may be coming before we finish development on the 1.0 release. So exciting!
Babel-related changes
AVA now ships with Babel 7. This applies to test and helper file compilation. The Babel recipe has been updated with the latest details:
We'll now automatically use your project's Babel configuration. The "default"
and "inherit"
configuration values have been removed. Babel options must now be specified in a testOptions
object. This will allow us to add source related options in the future.
You can disable ES module compilation:
{
"ava": {
"babel": {
"testOptions": {
"presets": [
["ava/stage-4", {"modules": false}]
]
}
}
}
}
Our @ava/stage-4
preset is now accessible via ava/stage-4
. We've added transforms for the latest ES2018 features where available. You can also disable ava/stage-4
entirely:
{
"ava": {
"babel": {
"testOptions": {
"presets": [
["ava/stage-4", false]
]
}
}
}
}
The powerAssert
option and command line flags have been removed. You can now disable AVA's test enhancements by setting compileEnhancements
to false
. If you do this enhancements you can disable AVA's Babel pipeline completely:
{
"ava": {
"babel": false,
"compileEnhancements": false
}
}
Tests must now have titles, and they must be unique
You can no longer do:
test(t => t.pass());
Instead all tests must have titles, and they must be unique within the test file:
test('passes', t => t.pass());
This makes it easier to pinpoint test failures and makes snapshots better too.
Note that AVA no longer infers a test title from a function name:
test(function myTest (t) {
t.pass();
});
Configuration changes
As mentioned above, the powerAssert
option has been removed, and the babel
option has changed significantly. The source
option has been renamed to sources
. This is now consistent with files
. AVA will exit with an error if it encounters the source
option.
We've also removed unintentional support for init
, watch
and updateSnapshot
options.
Supported Node.js versions
We've published a statement with regards to which Node.js versions we intend to support. As of this release we're only supporting Node.js 4.8.7 or newer, 6.12.3 or newer and 8.9.4 or newer. This does not include Node.js 5 and 7.
Remaining changes
t.throws()
andt.notThrows()
now accept functions that return observables or promises. The assertion will check them for errors. 40604ee- You can now specify helpers — that need to be compiled by AVA — in the
require
configuration. 56b56c1 - Caches are shared between test and helper file globbing operations. This is a stop-gap measure that'll hopefully improve performance. a84c96f
All changes 📚
Thanks 💌
💖 Huge thanks to @okyantoro for helping us with this release. We couldn’t have done it without you!
Get involved ✌️
We welcome new contributors. AVA is a friendly place to get started in open source. We have a great article on getting started contributing and a comprehensive contributing guide.