Changelog History
Page 3
-
v3.2.0 Changes
February 02, 2020๐ This release improves the integration with the new
@ava/typescript
package, which allows AVA to load pre-compiled TypeScript files.๐ฆ First, install the new
@ava/typescript
package:npm install --save-dev @ava/typescript@^1.1
๐ Now let's assume your TypeScript files are in a
src
directory, output to abuild
directory. Configure AVA like so:ava.config.js
file:export default { typescript: { rewritePaths: { 'src/': 'build/' } } }
โ Compile your TypeScript files and run your tests! Or, to run a specific test file, run
npx ava src/test.ts
.๐ For more examples see the
@ava/typescript
package.๐ As exciting as this is, it's still early days. We need your help improving our TypeScript support. Check out the open issues.
Other changes
๐ See v3.1.0...v3.2.0 for all changes.
-
v3.1.0 Changes
January 26, 2020AVA can now load pre-compiled TypeScript files!
๐ฆ First, install the new
@ava/typescript
package:npm install --save-dev @ava/typescript
๐ Now let's assume your TypeScript files are in a
src
directory, output to abuild
directory. Configure AVA like so:ava.config.js
file:export default { typescript: { rewritePaths: { 'src/': 'build/' } } }
โ Compile your TypeScript files and run your tests! Or, to run a specific test file, run
npx ava src/test.ts
.๐ For more examples see the
@ava/typescript
package.๐ As exciting as this is, it's still early days. We need your help improving our TypeScript support. Check out the open issues.
Other changes
Thanks to @jhechtf for fixing our TypeScript recipe after the changes in AVA 3.0 91a0086
๐ See v3.0.0...v3.1.0 for all changes.
-
v3.0.0 Changes
January 19, 2020๐ฑ We're proud to introduce AVA 3! ๐
๐ When we began AVA, JavaScript was very different. Most syntax you find familiar today was not supported by Node.js. Instead we relied on Babel to support that syntax before it made its way to Node.js itself.
๐ These days most new stage-4 syntax is adopted quickly. It's often not necessary to transpile anything. Therefore we're removing our built-in Babel support from AVA itself.
๐ Without Babel you'll have to resort to using
require()
functions in your JavaScript files. But, you say, Node.js 13 supports ECMAScript Modules!๐ Well, we're getting there. For a start, AVA now also looks for
.cjs
files. And.mjs
files are recognized too, but can't be loaded just yet. This also impactsava.config.js
files. If you'd like to help out delivering full.mjs
support check out the issues in the ESM support project.๐ Removing Babel allowed us to simplify how test files are selected. Likely non-test files, inside "fixture" or "helper" directories are ignored. The same for files that are inside an underscore-prefixed directory. We've made some other breaking changes in this area so please do read the full release notes.
๐ง You can again pass glob patterns on the CLI. However these now filter the test files that AVA already selected based on the configuration. In other words you can't run files that wouldn't be run by invoking
npx ava
.๐ง AVA now interrupts your tests if there's no progress for 10 seconds. Use the
timeout
configuration or--timeout
CLI option to change this.๐ New features
Built-in debug mode
โ You can now debug individual test files using the V8 Inspector:
npx ava debug test.js
๐ Connect to the debugger with Chrome DevTools. Or set up a debugger in VSCode.
๐ง Configurable Node.js arguments
๐ง You can now configure the arguments passed to Node.js itself when AVA starts its worker processes. Use the
nodeArguments
configuration or combine with the--node-arguments
CLI option.All breaking changes
๐ Supported Node.js versions
๐ We now support Node.js 10, 12 and 13. The minimal versions are 10.18.0, 12.14.0 and 13.5.0 respectively.
Removing Babel
๐ง Utilize Babel with AVA by installing our
@ava/babel
package and then enabling Babel by settingbabel: true
in the AVA configuration. Having this as a separate package means it can evolve independently.๐ง The
compileEnhancements
setting has been moved into thebabel
configuration. Consequently, thet.assert()
assertion will only print its detailed information when you use Babel. And we won't be able to catch typical mistakes witht.throws()
as well as we could before.๐ฆ The
ava/stage-4
preset is now available from@ava/babel/stage-4
. Our old@ava/babel-preset-transform-test-files
and@ava/babel-preset-stage-4
packages are no longer maintained and not installed with AVA itself.๐ ECMAScript Module Support
โ AVA now also looks for
.cjs
and.mjs
test files. That said,.mjs
files cannot be loaded just yet.Also, when you add
"type": "module"
, AVA would really like to treat.js
files as ECMAScript Modules, but can't just yet.๐ง Similarly,
ava.config.cjs
configuration files are now supported.ava.config.mjs
files not just yet.With AVA 2, we loaded
ava.config.js
files using theesm
package. To avoid confusion between the different module formats we now only supportexport default
statements. Noimport
, no__filename
. Configuration files that have dependencies should be written as a.cjs
file for now.๐ง Configuration files can only have
.cjs
,.js
and.mjs
extensions.๐ The remaining work is tracked in the ESM support project.
File selection
๐ง When you use the default configuration AVA will no longer select files matching the following glob patterns:
**/ __tests__ /** / __helper__ /**/*
**/ __tests__ /** / __helpers__ /**/*
**/ __tests__ /** / __fixture__ /**/*
**/ __tests__ /** / __fixtures__ /**/*
- โ
**/test/** /helper/**/*
- โ
**/test/** /helpers/**/*
- โ
**/test/** /fixture/**/*
- โ
**/test/** /fixtures/**/*
- โ
**/tests/** /helper/**/*
- โ
**/tests/** /helpers/**/*
- โ
**/tests/** /fixture/**/*
- โ
**/tests/** /fixtures/**/*
Additionally, when a file has a parent directory that starts with a single underscore, it can never be a test file.
๐ฆ
test.js
files are only selected if they're next to thepackage.json
file, or inside top-levelsrc
andsource
directories.๐ง We've removed the configuration of helpers. Previously, files selected by the
helpers
glob patterns were never considered test files. Now that this configuration is no longer supported you'll need to ensure thefiles
patterns exclude your helper files. If you're using Babel, you can configure the compilation of additional files .๐ง The
sources
configuration has also been removed. Instead, use theignoredByWatcher
configuration. Changes to files matched by these glob patterns will not cause the watcher to rerun tests.Negated
sources
patterns must be used without the negation inignoredByWatcher
:export default {- sources: ['!examples/\*\*/\*']+ ignoredByWatcher: ['examples/\*\*/\*'] }
CLI changes
๐ฆ Internally we've replaced
meow
byyargs
. We're not expecting things to break because of this, but you never know.Resetting the cache
The
--reset-cache
argument has been replaced by a properreset-cache
command:npx ava reset-cache
File selection (again!)
AVA again accepts glob patterns via the CLI:
npx ava '\*\*/api/\*\*/\*'
๐ง The way this work is that AVA first finds all test files, according to the configuration, and then filters to select just the files that also match the glob patterns passed via the CLI.
You can still pass paths to specific files:
npx ava src/api/test/my-api-test.js
๐ง However unlike with AVA 2, you can no longer specify test files that aren't already selected by AVA's configuration.
t.throws()
andt.throwsAsync()
assertionsThe second argument passed to these assertions must now be an
expectation
object. You can no longer pass the expected constructor, error message or regular expression.Other breaking changes
- ๐ Support for old
esm
versions has been removed. - โ We've set a default test timeout of 10 seconds. This means that if no test results are received for 10 seconds, AVA forces its worker processes to quit.
- The
NODE_PATH
environment variable is no longer rewritten to ensure values are absolute paths. - ๐ท AVA longer fakes the TTY in worker processes.
Other changes
- โก๏ธ We've simplified how we identify observables. Any object returned by a test implementation that has a
subscribe
function is assumed to be an observable. AVA's type definition has been updated accordingly. - โ The TAP reporter now reports hook failures as test failures.
- ๐ We've added an example of module path mapping to our TypeScript recipe.
- โ We've added a Selenium WebDriver JS recipe.
All changes
Thanks
โ Thank you @tymfear, @HeathNaylor, @grnch, @alexdrans, @MoppetX, @jimmywarting, @micaelmbagira, @aptester, @theashraf, @sramam and @maximelkin. We couldn't have done this without you!
-
v3.0.0-beta.2 Changes
January 12, 2020๐ We've been busy building AVA 3. It comes with a fair amount of breaking changes but also some exciting features, like a built-in debug mode!
๐ This is the second beta release. It addresses the known issues from the first beta.
๐ Please read the 3.0.0 Beta 1 release notes first
๐ Fixes
t.assert()
once again counts as a passed assertion- โก๏ธ
--update-snapshots
works again console
andprocess
are available inava.config.js
files
โจ Enhancements
- Timeouts are disabled in debug mode
- โ We've added a Selenium WebDriver JS recipe
All changes
Thanks
โ Thank you @aptester, @theashraf and @sramam. We couldn't have done this without you!
-
v3.0.0-beta.1
January 05, 2020 -
v2.4.0 Changes
September 16, 2019Experimental
t.try()
assertionsโ Thanks to the amazing work and patience of @qlonik we're shipping a new assertion!
t.try()
lets you perform assertions and decide whether to commit or discard their outcome. All kinds of interesting things can be built on top of this, from fuzzy testers to new test interfaces and more.We're excited to get this out there, but it's not quite done yet. For now you have to opt in to this new feature. Being opt-in, we may make changes (breaking ones even!) until we feel this is stable.
๐ง To opt in, configure AVA with the following:
๐ฆ
package.json
:{ "ava": { "nonSemVerExperiments": { "tryAssertion": true } } }
ava.config.js
:export default { nonSemVerExperiments: { tryAssertion: true } };
We'd love to hear your feedback. Please join us in this issue: #2250
Also, if you're looking to help out with the remaining issues so that we can ship this without the opt-in, have a look at this project: https://github.com/orgs/avajs/projects/1
Thanks again @qlonik!
Other changes
- โ We've added the common pitfall of sharing variables across asynchronous tests 49b202f
- โก๏ธ We've updated the endpoint testing recipe to focus on the concept, not specific libraries 67e4dea
All changes
Thanks
Thank you @jeremenichelli, @jamesgeorge007, @dongjae93, @qlonik and @tryzniak. 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.
-
v2.3.0 Changes
August 18, 2019๐ Changes
- ๐ We've fixed some bugs to improve watch mode. ffa62ce 9e8d28f
- โ AVA now prints an error when it receives non-existent test files on the command line. f01d05f
- โ When using the TAP reporter, remaining tests are now included in failed test count. Failed hooks are no longer treated as test failures, and logs are printed. 8628976
- ๐จ Internal errors that may occur for some edge cases are now printed. b27cb8d
- ๐ท TTY in the worker processes should follow the new APIs in Node.js 12.7.0 (when used with those Node.js versions). 7dcb473
- ๐ AVA now handles stage-4 syntax like dynamic import, and stage-3 syntax like BigInt, numeric separators and class properties that are supported by V8. 9baca8c
- ๐ AVA now supports dynamic import through our stage-4 preset.
- ๐ AVA now uses
import-local@^3.0.2
which fixes issues with Lerna projects. - For our TypeScript users , we've changed the default type of
t.context
tounknown
, in line with TypeScript's changes in their 3.5 release. 2fc7d56
All changes
Thanks
Thank you @MarchWorks, @yovasx2 and @bobthekingofegypt. 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.
-
v2.2.0 Changes
July 08, 2019โจ Enhancements
โ You can now specify an alternative config file, using the
--config
CLI argument. This is useful if you want to run unit tests separately from integration tests, since you can have a config file specific to your integration tests which specifies different glob patterns. 2dae2bf๐ Bug fixes
โ We're now faking the new
hasColors()
method for better compatibility with Node.js 12. d399797Node.js 11
โฌ๏ธ We've removed Node.js 11 from our test matrix. You should upgrade to Node.js 12. 90acbb9
All changes
Thanks
Thank you @langri-sha, @keyspress, @cdaringe and @okyantoro. 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.
-
v2.1.0 Changes
June 10, 2019๐ Bug fixes
- AVA's TypeScript definition now explicitly references the Node.js definition bb44da7
โจ Enhancements
- โฑ Did you know you can provide human-readable timeout values? We've now documented this. 486acaf
- We're now including all stack trace lines in the TAP output (though we still pre-process them). ac212ba
- ๐ Logs from successful hooks are now included in the TAP output. 007c7af
- โก๏ธ Our ESLint plugin helper has been updated to allow extensions and glob patterns to be overridden b3c9ea7
All changes
Thanks
Thank you @anishkny, @yovasx2 and @mihai-dinu. 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.
-
v2.0.0 Changes
June 01, 2019๐ฅ 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
andsources
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 ahelpers
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 watchesava.config.js
files.โ AVA now also selects files ending with
.spec.js
when looking for tests, as well as looking intests
directories. 08e99e5 b1e54b1The 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. 0804107Assertion 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. 98034fbSpecify environment variables in your AVA config
You can now specify environment variables in your config, using the
environmentVariables
object. a53ea15Other changes
- We've added
UntitledMacro
andUntitledCbMacro
types, for macro functions that will never have a.title
function. 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.
- We've added