create-test-server
create-test-server copied to clipboard
Update ava to the latest version π
The devDependency ava was updated from 0.25.0 to 1.0.1.
This version is not covered by your current version range.
If you donβt accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.
Release Notes for 1.0
AVA 1.0 π
Back in January we started work on the 1.0 release, taking the opportunity to upgrade to Babel 7 and follow its beta releases. It's been a year where we made massive improvements to AVA. It's also been a year with many exciting events in our personal lives. Be it honeymoons & weddings, work & friends, naturalizations and international relocations.
So, we're done. Or, rather, we're just beginning. Testing can be a drag. AVA helps you get it done. Its concise API, detailed error output, embrace of new language features and process isolation let you write tests more effectively. So you can ship more awesome code or do non-programming things.
Starting now we'll push out patches and new features more regularly. And, when the time comes, ship a 2.0 and a 3.0 and so forth. If you like what we're doing, why not try and contribute? We're a friendly bunch and we could use your help to make AVA even better.
We couldn't have gotten here without the nearly one hundred people who've contributed more, and the many more who suggested improvements, reported bugs and provided feedback. And, of course, everyone who's used AVA. Thank you for your enthusiasm and support.
What's new & improved
Assertions
New t.throws() behavior & t.throwsAsync()
We've rewritten t.throws() so it behaves better, has better error output and lets you write better tests:
- The assertion takes a first thrower argument. It must throw an exception, or your test fails. Throwing other values like strings also causes your test to fail.
- The exception must be an error object.
- The assertion returns the exception.
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
messageshould be equal to it. - If you pass a regular expression: the exception's
messageshould 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, {code: 'ENOTFOUND'}) // err.code === 'ENOTFOUND'
t.throws(fn, {code: 9}) // err.code === 9
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'This makes tests like these much easier to write:
// Old assertion
const err = t.throws(fn, TypeError)
t.is(err.message, 'Expected a string')
// New assertion
t.throws(fn, {
instanceOf: TypeError,
message: 'Expected a string'
})
We've removed promise support from t.throws() and t.notThrows(). Use the new t.throwsAsync() and t.notThrowsAsync() assertions instead. Support for observables has been removed completey.
The original behavior was both hard to explain and hard to express in Flow and TypeScript. Now, if you have a function that throws a synchronous error, use t.throws() (or t.notThrows()). If you have a promise that should reject, or an asynchronous function that should fail, use await t.throwsAsync() (or await t.notThrowsAsync()).
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.jsChange test.js to a glob pattern that matches your test files. See the jscodeshift CLI usage documentation for further details.
Bound assertion methods
Assertion methods are now bound to the test, meaning you can provide them as direct arguments to other functions. A contrived example:
const assertEach = (arr, assert) => {
arr.forEach(value => assert(value));
};
test('all are true', t => {
assertEach(getArray(), t.true);
});
Whilst not strictly assertions, t.plan() and t.log() are now also bound to the test.
BigInt
As part of our Node.js 10 support you can now use BigInt values in t.deepEqual() and t.snapshot(). Note that this is still a stage-3 proposal.
Babel 7
AVA now uses Babel 7, with support for babel.config.js files. We'll automatically use your project's Babel configuration. Babel options must now be specified in a testOptions object. This will allow us to add source related options in the future.
Our @ava/stage-4 preset is now accessible via ava/stage-4. We've added transforms for the latest ES2018 features where available (and even an ES2019 one!). You can also disable ava/stage-4 entirely:
package.json:
{
"ava": {
"babel": {
"testOptions": {
"presets": [
["ava/stage-4", false]
]
}
}
}
}Or, you can disable just ES module compilation:
package.json:
{
"ava": {
"babel": {
"testOptions": {
"presets": [
["ava/stage-4", {"modules": false}]
]
}
}
}
}The powerAssert option and command line flags have been removed. You can now disable AVA's test enhancements by setting compileEnhancements to false. You can also disable AVA's Babel pipeline entirely:
package.json:
{
"ava": {
"babel": false,
"compileEnhancements": false
}
}Serial hooks and context
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.
t.context can now be used in .before and .after hooks.
CLI
Pass flags to your test
AVA now forwards arguments, provided after an -- argument terminator, to the worker processes. Arguments are available from process.argv[2] onwards.
npx ava test.js -- hello worldThere'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.
Resetting AVA's cache
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 the cache configuration option.
npx ava --reset-cacheConfiguration
Introducing ava.config.js
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.
Configurable test & helper file extensions
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:
package.json:
{
"ava": {
"babel": {
"extensions": ["js", "jsx"]
}
}
}Or define generic extensions, e.g. for use with TypeScript:
package.json:
{
"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.
Snapshots
Adding new snapshots no longer causes the Markdown files to become malformed. Snapshots are now consistent across operating systems. If you've previously generated snapshots on Windows, you should update them using this release.
We now support BigInt and <React.Fragment> in 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.
We've improved how AVA builds snapshot files to better support precompiled projects. Say, if you compile your TypeScript test files using tsc before running AVA on the build output. AVA will now use the source map to figure out the original filename and use that as the basis for the snapshot files. You'll have to manually remove snapshots generated by previous AVA versions.
Type definitions
The TypeScript and Flow definitions have been rewritten and much improved. The TypeScript recipe has been updated to reflect the changes, and there's a new Flow recipe too.
TypeScript
AVA recognizes TypeScript build errors when using ts-node/register.
TypeScript now type-checks additional arguments used by macros. You must type the arguments used:
import test, {Macro} from 'ava'
const failsToParse: Macro<[Buffer]> = (t, input) => {
t.throws(parse(input))
}
failsToParse.title = (providedTitle = 'unexpected input') => </span>throws when parsing ${<span class="pl-smi">providedTitle</span>}<span class="pl-pds">
test('malformed', failsToParse, fs.readFileSync('fixtures/malformed.txt'))
test(failsToParse, '}') // β¬
οΈ fails to compile
Other improvements
- You can now specify helpers β that need to be compiled by AVA β in the
requireconfiguration. --fail-fastbehavior 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-fastis enabled.- AVA now uses its own Chalk instance, so AVA's color settings no longer impact the code you're testing.
- Error serialization has been made smarter, especially if non-Error errors are encountered.
- Uncaught exceptions and unhandled rejections are now shown with a code excerpt.
- You should see fewer repeated test timeout messages.
- Error messages now link to the documentation appropriate for the version of AVA you're using.
- 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-varspackage for a list of supported CI environments. - AVA now detects when it's required from a Node.js REPL.
- We've improved the colors for use on light terminal themes.
- The
assertmodule in Node.js 10 no longer crashes. - Source maps, generated by AVA when compiling test & helper files, now contain correct paths to the source files.
- TTY support for
process.stderris now emulated in the worker processes. - The default reporter now includes files that did not declare any tests in its final output.
- AVA now prints pending tests when timeouts occur, when using
--verbose. <React.Fragment>can be used int.deepEqual.titlefunctions of macros now receiveundefinedrather than an empty string if no title was given in the test declaration. This means you can use default parameters.
Breaking changes since 0.25.0
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 6.12.3 or newer, 8.9.4 or newer, 10.0.0 or newer and 11.0.0 or newer. This does not include Node.js 7 and 9.
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();
});Modifier chaining
AVA's various test modifiers (.serial, .skip) must now be used in the correct order:
.serialmust be used at the beginning, e.g.test.serial()..onlyand.skipmust be used at the end, e.g.test.skip(). You cannot combine them..failingmust be used at the end, but can be followed by.onlyand.skip, e.g.test.cb.failing()andtest.cb.failing.only()..alwayscan only be used after.afterand.afterEach, e.g.test.after.always()..todo()is only available ontestandtest.serial. No further modifiers can be applied.
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.
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'.
Set default title using parameters syntax
Macros can generate a test title. Previously, AVA would call the title function with an empty string if no title was given in the test declaration. Now, it'll pass undefined instead. This means you can use default parameters. Here's an example:
import test from 'ava'
const failsToParse = (t, input) => {
t.throws(parse(input))
}
failsToParse.title = (providedTitle = 'unexpected input') => </span>throws when parsing <span class="pl-s1"><span class="pl-pse">${</span>providedTitle<span class="pl-pse">}</span></span><span class="pl-pds">
test('malformed', failsToParse, fs.readFileSync('fixtures/malformed.txt'))
test(failsToParse, Buffer.from('}', 'utf8'))
This is a breaking change if you were concatenating the provided title, under the assumption that it was an empty string.
Assertions
t.throws() & t.notThrows()
Thrown exceptions (or rejection reasons) must now be error objects.
t.throws() and t.notThrows() no longer support observables or promises. For the latter, use await t.throwsAsync() and await t.notThrowsAsync() instead.
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.jsChange test.js to a glob pattern that matches your test files. See the jscodeshift CLI usage documentation for further details.
Skipping assertions
Assertions can be skipped by using .skip at the end of the assertion, e.g. t.deepEqual.skip(). You can now safely skip snapshot tests, though not whilst updating snapshots.
t.ifError()
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.
Configuration changes
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.
Babel
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.
The powerAssert option and command line flags have been removed. You can now disable AVA's test enhancements by setting compileEnhancements to false.
The Babel recipe has been updated with the latest details.
Updated type 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.
TypeScript now type-checks additional arguments used by macros. You must type the arguments used.
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._testvalue 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 potential breaking changes
- We've removed support for
@std/esm, in favor of the plainesmpackage. - The
ava/stage-4preset is applied after all other plugins and presets. - Test implementations are now called with
nullas thethisvalue. - All reporters write to
stdout. Thestdoutandstderroutput from workers is written toprocess.stderr. AVA will insert linebreaks inprocess.stdoutafter writing a chunk toprocess.stderrthat does not end in a line break. - The
--no-cacheCLI flag has been replaced by a--reset-cachecommand. The latter resets AVA's regular cache location. You can still disable the cache through thecacheconfiguration option. - We've dropped support for using generator functions as test implementations. This was a remnant of the dark days before
async/awaitsupport. - Snapshots need to be regenerated.
- If you pre-compile your test files, the snapshot files may be created at new file paths. You'll have to manually remove any old files.
New recipes
There's a new recipe on using ES modules. We've also added a recipe on setting up tests and how test webapps using AVA and Puppeteer.
All changes π
Thanks π
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.
Commits
The new version differs by 218 commits.
783944f1.0.1024bab71.0.0aac41dcReword introduction84d8fffBump dependencies & update documentationc1364a1Update the tagline and readme intro (#1983)eed2e7aClarify that not all configuration options can be overridden by CLI flags93e91c9Fix 'sources' option in configuration docs3bc80b0Remove moot ESLint disable comment311c197Fix snapshot skip interface0e82b041.0.0-rc.2f97e277Bump dependencies6f54db8Type additional arguments used by macrosa82fee5Documentation updatesafe028aCI updates1ba31d8Reorganize documentation
There are 218 commits in total.
See the full diff
FAQ and help
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper bot :palm_tree:
- The
devDependencyava was updated from0.25.0to1.1.0.
Update to this version instead π
Release Notes for 1.1.0
1.1.0
New features
AVA now exports a meta object. Currently, you can retrieve the path of the test file being run:
import test from 'ava';
console.log('Test currently being run: ', test.meta.file);
import {meta} from 'ava';
console.log('Test currently being run: ', meta.file);
This is useful in helpers that need to know the test file. bccd297
Bug fixes and other improvements
-
t.log()now works in hooks d187712 -
Error output for improper usage of
t.throws()once again links to the correct documentation dc552bc -
We've added a section on webpack aliases to the Babel recipe c3bcbf2
-
We've updated the Vue recipe for Babel 7, and added a section on webpack aliases c3bcbf2
All changes π
Thanks π
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.
Commits
The new version differs by 9 commits.
a28094a1.1.07262a78Bump dependenciesd187712Fix t.log() in hooksbccd297Expose test file path within worker processc3bcbf2Improve Babel and Vue recipesdc552bcUpdate link tot.throws()assertion in AVA outputf4b2d19Fix links to French translation of docs (#2005)2e72fe7Fix npm install command in readme (#2001)7b6e578Use newer ES syntax where possible
See the full diff
- The
devDependencyava was updated from0.25.0to1.2.0.
Update to this version instead π
Release Notes for 1.2.0
New features
You can now set a timeout for test themselves. The test will fail if this timeout is exceeded. The timeout is reset each time an assertion is made:
test('foo', t => {
t.timeout(100); // 100 milliseconds
// Write your assertions here
});AVA also has a global timeout feature. The mini reporter now logs tests that were pending when those timeouts occur. Additionally, if you interrupt a test using ctrl+c we'll now also show the pending tests. 2b60556
Thank you @dflupu for your hard work on this!
Bug fixes and other improvements
- We're no longer truncating multi-line error messages 72e0762
- Unexpected errors in the throws assertions are now reported with the correct stack trace ad087f2
- The Debugging with VSCode recipe has been updated with the correct
workspaceFoldervariable 0a5fe42 and--serialargument placement edfc005
All changes π
Thanks π
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.
Commits
The new version differs by 11 commits.
010914b1.2.0ad087f2Fix stack traces in throw assertions8ad5efdBump dependencies2b60556Print pending tests on interrupt, and on timeout in mini reporter0a5fe42Change deprecated workspaceRoot variable to the equivalent workspaceFolderb65c6d7Addt.timeout()ed7807eLinter fixesf0a07cdRely on npm 6.6.06b10f2eBump XO and fix some lint issues72e0762Fix accidental truncation of multi-line error messagesedfc005Fix profile.js example
See the full diff
- The
devDependencyava was updated from0.25.0to1.2.1.
Update to this version instead π
Release Notes for 1.2.1
This is a bug fix release. In very large projects, the options send to worker processes would exceed limits on process argument size. We're now sending the options via the inter-process communication channel. 3078892
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.
- The
devDependencyava was updated from0.25.0to1.3.0.
Update to this version instead π
Release Notes for 1.3.0
Bug fixes
- We've fixed a rather embarrasing bug with
t.throws()andt.throwsAsync(). If you'd set acodeexpectation to a number we never actually checked that the thrown error had such a code! Thanks to @qlonik for both spotting and fixing this. 82daa5e - 1.2.0 contained a regression which meant that if you faked
clearTimeout(), you'd break AVA. That's now been fixed. 40f331c - Snapshot files are now recognized as source files, so if you're using watch mode and you delete one, AVA won't rerun all your test files. d066f6f
New features
You can now use require() in ava.config.js files to load non-ES modules. 334e15b
All changes
Thanks
Thank you @itaisteinherz, @jdalton, @kagawagao, @KompKK, @SleeplessByte, @Chrisyee22 and @qlonik for helping us with this release. We couldn't have done this 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.
Commits
The new version differs by 12 commits.
b0fadb41.3.09600966Bump dependencies82daa5eAssert on expected error code, even when a number1e3b072Documenttimeoutconfigurationd97f11dImprove pronunciation examples40f331cFix unbound reference to clearTimeout334e15bSupport require() in config files5751226Added few tests for lib/chalk.js7d10446Fix link to Babel recipe565822eUpdate esm package detection2fce19fRemove thetypingsfield in package.jsond066f6fRecognize snapshot files as source files
See the full diff
- The
devDependencyava was updated from0.25.0to1.3.1.
Update to this version instead π
Release Notes for 1.3.1
Bug fixes
- We've fixed a rather embarrasing bug with
t.throws()andt.throwsAsync(). If you'd set acodeexpectation to a number we never actually checked that the thrown error had such a code! Thanks to @qlonik for both spotting and fixing this. 82daa5e - 1.2.0 contained a regression which meant that if you faked
clearTimeout(), you'd break AVA. That's now been fixed. 40f331c - Snapshot files are now recognized as source files, so if you're using watch mode and you delete one, AVA won't rerun all your test files. d066f6f
New features
You can now use require() in ava.config.js files to load non-ES modules. 334e15b
All changes
Thanks
Thank you @itaisteinherz, @jdalton, @kagawagao, @KompKK, @SleeplessByte, @Chrisyee22 and @qlonik for helping us with this release. We couldn't have done this 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.
- The
devDependencyava was updated from0.25.0to1.4.0.
Update to this version instead π
Release Notes for 1.4.0
Focusing power-assert
AVA comes with power-assert built-in, giving you more descriptive assertion messages. However it's been confusing to understand which assertions come with power-assert. To address this we've added the new t.assert() assertion. It's now the only assertion that is power-assert enabled. The assertion passes if called with a truthy value. Consider this example:
test('enhanced assertions', t => {
const a = /foo/;
const b = 'bar';
const c = 'baz';
t.assert(a.test(b) || b === c);
});AVA will output:
6: const c = 'baz'; 7: t.assert(a.test(b) || b === c); 8: });Value is not truthy:
false
a.test(b) || b === c
=> falseb === c
=> falsec
=> 'baz'b
=> 'bar'a.test(b)
=> falseb
=> 'bar'
a
=> /foo/
Our ESLint plugin has been updated to support this new assertion. Many thanks to @eemed for implementing this! 9406470
Watch mode
Watch mode now prints the available commands. Thanks @KompKK! cd256ac
Bug fixes
- Filtered tests (when using
--match,.skip()or.only()) are no longer included in the list of pending tests when timeouts occur or when you interrupt a test run. Thanks @vancouverwill! 23e302a - We're now shimming all TTY methods in the worker processes, thanks to @okyantoro. c1f6fdf
Documentation updates
- We've added a note to say that, by default, AVA does not have a default test timeout. Thanks @amokmen! 99a10a1
All changes
Thanks
Thank you @eemed, @KompKK, @vancouverwill, @okyantoro and @amokmen. We couldn't have done this 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.
Commits
The new version differs by 7 commits.
20db4741.4.00154a7fBump dependencies9406470Only apply power-assert to new t.assert() assertionc1f6fdfShim all tty methods23e302aDon't report filtered tests as pending99a10a1Document that there is no default timeoutcd256acPrint commands in watch mode
See the full diff
- The
devDependencyava was updated from0.25.0to1.4.1.
Update to this version instead π
Release Notes for 1.4.1
Focusing power-assert
AVA comes with power-assert built-in, giving you more descriptive assertion messages. However it's been confusing to understand which assertions come with power-assert. To address this we've added the new t.assert() assertion. It's now the only assertion that is power-assert enabled. The assertion passes if called with a truthy value. Consider this example:
test('enhanced assertions', t => {
const a = /foo/;
const b = 'bar';
const c = 'baz';
t.assert(a.test(b) || b === c);
});AVA will output:
6: const c = 'baz'; 7: t.assert(a.test(b) || b === c); 8: });Value is not truthy:
false
a.test(b) || b === c
=> falseb === c
=> falsec
=> 'baz'b
=> 'bar'a.test(b)
=> falseb
=> 'bar'
a
=> /foo/
Our ESLint plugin has been updated to support this new assertion. Many thanks to @eemed for implementing this! 9406470
Watch mode
Watch mode now prints the available commands. Thanks @KompKK! cd256ac
Bug fixes
- Filtered tests (when using
--match,.skip()or.only()) are no longer included in the list of pending tests when timeouts occur or when you interrupt a test run. Thanks @vancouverwill! 23e302a - We're now shimming all TTY methods in the worker processes, thanks to @okyantoro. c1f6fdf
Documentation updates
- We've added a note to say that, by default, AVA does not have a default test timeout. Thanks @amokmen! 99a10a1
All changes
Thanks
Thank you @eemed, @KompKK, @vancouverwill, @okyantoro and @amokmen. We couldn't have done this 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.
- The
devDependencyava was updated from0.25.0to2.0.0.
Update to this version instead π
Release Notes for 2.0.0
Breaking changes
AVA now requires at least Node.js 8.9.4
Per the Node.js release schedule, the 6.x releases reach end of live on April 30th. Consequently we've removed support in AVA. We are now testing with Node.js 12 though. 3a4afc6
Test file and helper selection
We've been working on simplifying how test files and helpers are selected. First off, the files option now only accepts glob patterns. If you configured it with directories before, please add /**/* to get the previous behavior.
The files and sources options must now be arrays containing at least one pattern. It's no longer possible to override a default exclusion pattern, but we're looking at making these configurable separately.
AVA used to treat all files inside a helpers directory as test helpers. Finding these files could be really slow, however, and it also meant you couldn't have tests inside a helpers directory. Instead you can now specify glob paterns to find these helpers:
{
"ava": {
"helpers": [
"**/helpers/**/*"
]
}
}Test files starting with an underscore are still recognized as helpers.
Files inside fixtures directories are no longer ignored, and will now be treated as test files. The watcher now also watches ava.config.js files.
AVA now also selects files ending with .spec.js when looking for tests, as well as looking in tests directories. 08e99e5 b1e54b1
The CLI now only takes file paths, not glob patterns.
We'd like some help updating our ESLint plugin as well.
Snapshots in CI
When you run tests locally and add a new snapshot, AVA automatically updates the .snap file. However if you forget to commit this file and then run your CI tests, they won't fail because AVA quietly updates the .snap file, just like it does locally.
With this release, AVA will fail the t.snapshot() assertion if it is run in CI and no snapshot could be found. 0804107
Assertion messages must be strings
AVA now enforces assertion messages to be strings. The message is only used when the assertion fails, and non-string values may cause AVA to crash. You may see test failures if you were accidentally passing a non-string message. 49120aa
Flow type definitions
We've decided to remove the Flow type definitions from AVA itself. We don't have anybody to maintain them and consequently they've become a blocker when adding features to AVA. c633cf0
We've set up a new repository from which we'll publish the definitions, but we need your help setting it up. If you use AVA and Flow, please join us in avajs/flow-typed#1.
Observable typing
Test implementations may return observables. We've updated our TypeScript definition to require these to have a Symbol.observable function. c2d8218
New features
Configurable printing depth
AVA now uses the util.inspect.defaultOptions.depth option when printing objects, so you can configure the depth. 98034fb
Specify environment variables in your AVA config
You can now specify environment variables in your config, using the environmentVariables object. a53ea15
Other changes
- We've added
UntitledMacroandUntitledCbMacrotypes, for macro functions that will never have a.titlefunction. Though really this just helped simplify the type definition. Thanks @qlonik! ebf4807 - The dependency tracking in watch mode now respects custom require hooks you install in the worker processes. Thanks @lo1tuma! cb4c809
- The TypeScript definition once again allows
test.skip(macro)ba5cd80 - AVA now exposes some methods to our ESLint plugin, allowing our plugin to support the new test & helper file selection. 51433be
All changes
Thanks
Thank you @StoneCypher, @LukasHechenberger, @lo1tuma, @htor, @alexisfontaine and @grnch. We couldn't have done this 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.
Commits
The new version differs by 36 commits.
e1572d92.0.02daf6a9Bump dependenciesb1e54b1By default, select test and helpers inside 'tests' directories677578fReplace individual lodash packages with the main packagea53ea15Define environment variables to be injected in the test file processes626e58c2.0.0-rc.151433beImplement helper for our ESLint pluginc10e38cRemove underline from Babel configuration validation errors928ed14Bump dependencies98034fbMake the object printing depth configurable (#2121)f26634b2.0.0-beta.280d72ffBump dependencies5f4c96fFurther helper selection improvementsba5cd80Fix TypeScript definition allowing macro-without-title-using-tests to be skipped13a89e1Reduce size of logo in readme
There are 36 commits in total.
See the full diff