Open greenkeeper[bot] opened 5 years ago
After pinning to 0.25.0 your tests are still failing. The reported issue might not affect your project. These imprecisions are caused by inconsistent test results.
devDependency
ava was updated from 1.0.1
to 1.1.0
.Your tests are still failing with this version. Compare changes
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
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
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 new version differs by 9 commits.
a28094a
1.1.0
7262a78
Bump dependencies
d187712
Fix t.log() in hooks
bccd297
Expose test file path within worker process
c3bcbf2
Improve Babel and Vue recipes
dc552bc
Update link to t.throws()
assertion in AVA output
f4b2d19
Fix links to French translation of docs (#2005)
2e72fe7
Fix npm install command in readme (#2001)
7b6e578
Use newer ES syntax where possible
See the full diff
devDependency
ava was updated from 1.2.0
to 1.2.1
.Your tests are still failing with this version. Compare changes
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
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 new version differs by 13 commits.
65133a8
1.2.1
3078892
Send options to worker process over IPC
010914b
1.2.0
ad087f2
Fix stack traces in throw assertions
8ad5efd
Bump dependencies
2b60556
Print pending tests on interrupt, and on timeout in mini reporter
0a5fe42
Change deprecated workspaceRoot variable to the equivalent workspaceFolder
b65c6d7
Add t.timeout()
ed7807e
Linter fixes
f0a07cd
Rely on npm 6.6.0
6b10f2e
Bump XO and fix some lint issues
72e0762
Fix accidental truncation of multi-line error messages
edfc005
Fix profile.js example
See the full diff
devDependency
ava was updated from 1.2.1
to 1.3.0
.Your tests are still failing with this version. Compare changes
t.throws()
and t.throwsAsync()
. If you'd set a code
expectation to a number we never actually checked that the thrown error had such a code! Thanks to @qlonik for both spotting and fixing this. 82daa5eclearTimeout()
, you'd break AVA. That's now been fixed. 40f331cYou can now use require()
in ava.config.js
files to load non-ES modules. 334e15b
Thank you @itaisteinherz, @jdalton, @kagawagao, @KompKK, @SleeplessByte, @Chrisyee22 and @qlonik for helping us with this release. We couldn't have done this without you!
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 new version differs by 12 commits.
b0fadb4
1.3.0
9600966
Bump dependencies
82daa5e
Assert on expected error code, even when a number
1e3b072
Document timeout
configuration
d97f11d
Improve pronunciation examples
40f331c
Fix unbound reference to clearTimeout
334e15b
Support require() in config files
5751226
Added few tests for lib/chalk.js
7d10446
Fix link to Babel recipe
565822e
Update esm package detection
2fce19f
Remove the typings
field in package.json
d066f6f
Recognize snapshot files as source files
See the full diff
devDependency
ava was updated from 1.3.0
to 1.3.1
.Your tests are still failing with this version. Compare changes
t.throws()
and t.throwsAsync()
. If you'd set a code
expectation to a number we never actually checked that the thrown error had such a code! Thanks to @qlonik for both spotting and fixing this. 82daa5eclearTimeout()
, you'd break AVA. That's now been fixed. 40f331cYou can now use require()
in ava.config.js
files to load non-ES modules. 334e15b
Thank you @itaisteinherz, @jdalton, @kagawagao, @KompKK, @SleeplessByte, @Chrisyee22 and @qlonik for helping us with this release. We couldn't have done this without you!
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.
devDependency
ava was updated from 1.3.1
to 1.4.0
.Your tests are still failing with this version. Compare changes
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);
});
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 now prints the available commands. Thanks @KompKK! cd256ac
--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! 23e302aThank you @eemed, @KompKK, @vancouverwill, @okyantoro and @amokmen. We couldn't have done this without you!
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 new version differs by 7 commits.
20db474
1.4.0
0154a7f
Bump dependencies
9406470
Only apply power-assert to new t.assert() assertion
c1f6fdf
Shim all tty methods
23e302a
Don't report filtered tests as pending
99a10a1
Document that there is no default timeout
cd256ac
Print commands in watch mode
See the full diff
devDependency
ava was updated from 1.4.0
to 1.4.1
.Your tests are still failing with this version. Compare changes
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);
});
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 now prints the available commands. Thanks @KompKK! cd256ac
--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! 23e302aThank you @eemed, @KompKK, @vancouverwill, @okyantoro and @amokmen. We couldn't have done this without you!
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.
devDependency
ava was updated from 1.4.1
to 2.0.0
.Your tests are still failing with this version. Compare changes
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
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.
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
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
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.
Test implementations may return observables. We've updated our TypeScript definition to require these to have a Symbol.observable
function. c2d8218
AVA now uses the util.inspect.defaultOptions.depth
option when printing objects, so you can configure the depth. 98034fb
You can now specify environment variables in your config, using the environmentVariables
object. a53ea15
UntitledMacro
and UntitledCbMacro
types, for macro functions that will never have a .title
function. Though really this just helped simplify the type definition. Thanks @qlonik! ebf4807test.skip(macro)
ba5cd80Thank you @StoneCypher, @LukasHechenberger, @lo1tuma, @htor, @alexisfontaine and @grnch. We couldn't have done this without you!
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 new version differs by 36 commits.
e1572d9
2.0.0
2daf6a9
Bump dependencies
b1e54b1
By default, select test and helpers inside 'tests' directories
677578f
Replace individual lodash packages with the main package
a53ea15
Define environment variables to be injected in the test file processes
626e58c
2.0.0-rc.1
51433be
Implement helper for our ESLint plugin
c10e38c
Remove underline from Babel configuration validation errors
928ed14
Bump dependencies
98034fb
Make the object printing depth configurable (#2121)
f26634b
2.0.0-beta.2
80d72ff
Bump dependencies
5f4c96f
Further helper selection improvements
ba5cd80
Fix TypeScript definition allowing macro-without-title-using-tests to be skipped
13a89e1
Reduce size of logo in readme
There are 36 commits in total.
See the full diff
devDependency
ava was updated from 2.0.0
to 2.1.0
.Your tests are still failing with this version. Compare changes
Thank you @anishkny, @yovasx2 and @mihai-dinu. We couldn't have done this without you!
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 new version differs by 9 commits.
00d9517
2.1.0
911d198
Tweak dependencies, CI
52fc67a
Fix package lock
bb44da7
Explicitly reference the Node.js type definition
b3c9ea7
Allow ESLint rules to override extensions and glob patterns
7366a9d
Store an error object in AssertionError rather than a stack trace
007c7af
Include logs from successful hooks in TAP output
ac212ba
Include all (beautified) stack trace lines in TAP reporter output
486acaf
Document timeout units
See the full diff
devDependency
ava was updated from 2.1.0
to 2.2.0
.Your tests are still failing with this version. Compare changes
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
We're now faking the new hasColors()
method for better compatibility with Node.js 12. d399797
We've removed Node.js 11 from our test matrix. You should upgrade to Node.js 12. 90acbb9
Thank you @langri-sha, @keyspress, @cdaringe and @okyantoro. We couldn't have done this without you!
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 new version differs by 9 commits.
2451484
2.2.0
e528ad2
Bump dependencies
2dae2bf
Implement --config flag
58b2350
Disable deprecation warnings in reporter tests
d399797
Fake hasColors()
in worker processes
90acbb9
Stop testing Node.js 11, remove from engines entry
533ee4b
Link to VSCode debugging recipe
dc91725
Fix grammar in readme
851316f
Remove Flow references
See the full diff
devDependency
ava was updated from 2.3.0
to 2.4.0
.Your tests are still failing with this version. Compare changes
t.try()
assertionsThanks 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!
Thank you @jeremenichelli, @jamesgeorge007, @dongjae93, @qlonik and @tryzniak. We couldn't have done this without you!
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 new version differs by 24 commits.
05f077e
2.4.0
ca4eff7
Bump dependencies
67e4dea
Update endpoint testing recipe to focus on the concept, not libraries
4fdb02d
Implement experimental t.try() assertion
782c2d8
Run some tests on Travis still
4c890d9
Add OpenCollective link to README
03c1509
Groundwork to support experimental features
0a5c933
Remove unnecessary flag from tap invocation
e598c30
Detect whether error source is on a different drive (on Windows)
fb0c536
Fix serialize-error tests on Windows with GitHub Actions
53d7fe1
Allow some fixtures to pass linting when XO is installed without lockfile
11771ba
Run CI using GitHub Actions
5538bdc
Replace an indexOf() by includes()
49b202f
Add shared variables & asynchronous tests to common pitfalls
1c81c4b
2.3.0
There are 24 commits in total.
See the full diff
devDependency
ava was updated from 2.4.0
to 3.0.0
.Your tests are still failing with this version. Compare changes
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 impacts ava.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.
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.
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.
We now support Node.js 10, 12 and 13. The minimal versions are 10.18.0, 12.14.0 and 13.5.0 respectively.
Utilize Babel with AVA by installing our @ava/babel
package and then enabling Babel by setting babel: true
in the AVA configuration. Having this as a separate package means it can evolve independently.
The compileEnhancements
setting has been moved into the babel
configuration. Consequently, the t.assert()
assertion will only print its detailed information when you use Babel. And we won't be able to catch typical mistakes with t.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.
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 the esm
package. To avoid confusion between the different module formats we now only support export default
statements. No import
, 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.
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 the package.json
file, or inside top-level src
and source
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 the files
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 the ignoredByWatcher
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 in ignoredByWatcher
:
export default {
- sources: ['!examples/**/*']
+ ignoredByWatcher: ['examples/**/*']
}
Internally we've replaced meow
by yargs
. We're not expecting things to break because of this, but you never know.
The --reset-cache
argument has been replaced by a proper reset-cache
command:
npx ava reset-cache
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()
and t.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.
esm
versions has been removed.NODE_PATH
environment variable is no longer rewritten to ensure values are absolute paths.subscribe
function is assumed to be an observable. AVA's type definition has been updated accordingly.Thank you @tymfear, @HeathNaylor, @grnch, @alexdrans, @MoppetX, @jimmywarting, @micaelmbagira, @aptester, @theashraf, @sramam and @maximelkin. We couldn't have done this without you!
The new version differs by 86 commits.
b4cfc8d
3.0.0
776788f
Ship v3 π
0d11ff7
More issue template tweaks
9983976
Update various contributing documents and GitHub configuration
5a33572
Fix fail-fast interrupt test
61e0d05
Fix VSCode debugging instructions
630aac3
Fix remaining AVA link
5c8bcec
Fix AVA link in snapshot reports
7b20f6c
Allow Node arguments to be configured
ad27246
3.0.0-beta.2
ae948d8
Lowercase CLI argument description asides
ac8c852
Update dependencies
2bd890f
Disable timeouts in debug mode
15d73ca
Make console & process globals available to ava.config.js files
efa8635
Fix patterns and unpin picomatch
There are 86 commits in total.
See the full diff
devDependency
ava was updated from 3.0.0
to 3.1.0
.Your tests are still failing with this version. Compare changes
AVA 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 a build
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.
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.
devDependency
ava was updated from 3.1.0
to 3.2.0
.Your tests are still failing with this version. Compare changes
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 a build
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.
See v3.1.0...v3.2.0 for all changes.
devDependency
ava was updated from 3.2.0
to 3.3.0
.Your tests are still failing with this version. Compare changes
AVA can now load ESM test files!
Our ESM support is still incomplete. Progress is tracked in the ESM support project. Join us, won't you?
See v3.2.0...v3.3.0 for all changes.
devDependency
ava was updated from 3.3.0
to 3.4.0
.Your tests are still failing with this version. Compare changes
t.try()
assertionThe new t.try()
allows you to try assertions without causing the test to fail:
test('do the thing', async t => {
const attempt = () => t.try(tt => {
const result = await getResult()
// getResult() can be flaky and sometimes throws :(
tt.is(result, 'expected')
})
const firstAttempt = await attempt()
if (firstAttempt.passed) return firstAttempt.commit()
t.log('Retrying (just once)')
firstAttempt.discard()
const secondAttempt = await attempt()
secondAttempt.commit()
})
You can use any test implementation with t.try()
, including (arrays of) macros. You can decide what to do with attempts. You can even run attempts concurrently, so long as they don't use snapshot assertions.
This is great building block for handling all kinds of advanced test scenarios. We can't wait to see what you'll do with it! Find out more in the assertion documentation.
This feature was previously behind an experimental flag. That flag has now been removed. If you have enabled the flag you'll have to update your AVA config. Also note that as of this release, attempt titles are always prefixed with the title of the parent test 7ee3a0e.
Once again, thank you @qlonik for contributing this new assertion.
t.throws()
and t.throwsAsync()
assertions can now be called with undefined
as the second argument. Previously, if you wanted to set an assertion message but did not want to provide any expectations for the thrown error you had to pass null
. That's still allowed, of course. d0e2161 @stavalfiava.config.js
files once again work with our @ava/typescript
package f4d4edd@types/node
7a1dacftest.cb()
is used with asynchronous functions or observables f5a8c2b @toddkcarlsonjsdom-global
instead of browser-env
3f9c616 @ScrumSee v3.3.0...v3.4.0 for all changes.
The new version differs by 13 commits.
8630636
3.4.0
12ba7bc
Ship t.try() without requiring opt-in
f4d4edd
Evaluate ava.config.js scripts in current context
8831f54
Improve detection of ESM support
d0e2161
Support undefined as second argument to t.throws and t.throwsAsync
324e45f
Document t.try()
(#2251)
da52e5f
Bump dependencies
55a3649
Ensure t.try() assigns unique titles when multiple implementations are passed
7ee3a0e
Prefix attempt titles with that of parent test
a69e4f2
Bump dependencies
7a1dacf
Remove @types/node reference
3f9c616
Update Vue recipe to use JSDom rather than browser-env
f5a8c2b
Improve error message when test.cb()
is used with promises
See the full diff
devDependency
ava was updated from 3.4.0
to 3.5.0
.Your tests are still failing with this version. Compare changes
When using ava debug
, you can now specify the address or hostname the inspector is available through by using the --host
option. Thanks to @DYefimov for contributing this! 13d6651
See v3.4.0...v3.5.0 for all changes. Spoiler alert: it's just this one
devDependency
ava was updated from 3.5.0
to 3.5.1
.Your tests are still failing with this version. Compare changes
devDependency
ava was updated from 3.5.2
to 3.6.0
.Your tests are still failing with this version. Compare changes
afterEach()
and afterEach.always()
hooks can now determine whether the test passed. Thank you @bunysae for contributing this! 8f312c0:
test('passes', t => t.pass());
test.afterEach(t => {
if (t.passed) {
// Do something because the test passed
} else {
// Do something because the test failed
}
});
@mbiesiad has diligently translated our documentation to Polish. Thank you @kekuu for reviewing.
Also thank you @timgates42 for fixing a typo in our documentation. ede4f32
See v3.5.0...v3.6.0 for all changes.
The new version differs by 7 commits.
447d371
3.6.0
886b4d7
Rebuild lockfile
1f59b05
Dependency updates
489b13e
Fix TypeScript documentation for t.try()
4bf64d0
Remove link to previously removed recipe
8f312c0
Add t.passed to execution contexts
ede4f32
Fix typo in endpoint testing recipe
See the full diff
devDependency
ava was updated from 3.6.0
to 3.7.0
.Your tests are still failing with this version. Compare changes
If you've ever wanted to save some files along with AVA's snapshots, you can now determine the directory path by accessing test.meta.snapshotDirectory
. Thank you @ulken ! cb5f9f7
See v3.6.0...v3.7.0 for all changes.
devDependency
ava was updated from 3.7.0
to 3.7.1
.Your tests are still failing with this version. Compare changes
devDependency
ava was updated from 3.7.1
to 3.8.0
.Your tests are still failing with this version. Compare changes
Great news, this is a feature heavy release!
First off, though, AVA now officially supports Node.js 14. Thank you @zackschuster! 2e7c76b
AVA can now run tests at specific line numbers!
Given the following test file:
test.js
1: test('unicorn', t => {
2: t.pass();
3: });
4:
5: test('rainbow', t => {
6: t.fail();
7: });
Running npx ava test.js:2
for would run the unicorn
test. In fact you could use any line number between 1
and 3
.
This feature is only available from the command line. It won't work if you use tools like ts-node/register
or @babel/register
, and it does not currently work with @ava/babel
and @ava/typescript
. See #2473.
Thank you @ulken for your hard work and patience to get this shipped. 1222ce9
Sometimes tests have side-effects you want to clean up. @ulken has implemented t.teardown()
which lets you register teardown functions within your test. They'll run once your test has finished, even if it failed: 75cbc3b
test('read file', t => {
fs.writeFileSync('file.txt', 'π');
t.teardown(() => fs.unlinkSync('file.txt');
// Run assertions
});
Thanks to @bunysae, stack traces now include Node.js internals. Previously we removed them because we wanted you to focus on your own code, but quite often they do provide context. Now they're displayed, but somewhat dimmed. 9a9351d
Watch mode with the default reporter once again accepts key input. Thanks @pcdevil! 59c227d
See v3.7.1...v3.8.0 for all changes.
The new version differs by 9 commits.
b669efa
3.8.0
0976cfe
Dependency updates
1222ce9
Run tests at selected line numbers
75cbc3b
Add t.teardown()
993bb90
Remove test slowness output checks from reporter tests
af7b2d5
Don't print empty error stacks
2e7c76b
Node.js 14 compatibility
59c227d
Fix watch mode with mini reporter
9a9351d
Retain (most of) Node.js internals in stack traces
See the full diff
devDependency
ava was updated from 3.8.0
to 3.8.1
.Your tests are still failing with this version. Compare changes
Great news, this is a feature heavy release!
First off, though, AVA now officially supports Node.js 14. Thank you @zackschuster! 2e7c76b
AVA can now run tests at specific line numbers!
Given the following test file:
test.js
1: test('unicorn', t => {
2: t.pass();
3: });
4:
5: test('rainbow', t => {
6: t.fail();
7: });
Running npx ava test.js:2
for would run the unicorn
test. In fact you could use any line number between 1
and 3
.
This feature is only available from the command line. It won't work if you use tools like ts-node/register
or @babel/register
, and it does not currently work with @ava/babel
and @ava/typescript
. See #2473.
Thank you @ulken for your hard work and patience to get this shipped. 1222ce9
Sometimes tests have side-effects you want to clean up. @ulken has implemented t.teardown()
which lets you register teardown functions within your test. They'll run once your test has finished, even if it failed: 75cbc3b
test('read file', t => {
fs.writeFileSync('file.txt', 'π');
t.teardown(() => fs.unlinkSync('file.txt');
// Run assertions
});
Thanks to @bunysae, stack traces now include Node.js internals. Previously we removed them because we wanted you to focus on your own code, but quite often they do provide context. Now they're displayed, but somewhat dimmed. 9a9351d
Watch mode with the default reporter once again accepts key input. Thanks @pcdevil! 59c227d
afterEach()
and afterEach.always()
hooks can now determine whether the test passed. Thank you @bunysae for contributing this! 8f312c0
test('passes', t => t.pass());
test.afterEach(t => {
if (t.passed) {
// Do something because the test passed
} else {
// Do something because the test failed
}
});
If you've ever wanted to save some files along with AVA's snapshots, you can now determine the directory path by accessing test.meta.snapshotDirectory
. Thank you @ulken! cb5f9f7
See v3.7.1...v3.8.1 for all changes.
devDependency
ava was updated from 3.8.1
to 3.8.2
.Your tests are still failing with this version. Compare changes
The devDependency ava was updated from
0.25.0
to1.0.1
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
ava is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
Status Details
- β **continuous-integration/appveyor/branch:** AppVeyor build failed ([Details](https://ci.appveyor.com/project/easilyBaffled/pid-from-port/builds/21032536)). - β **continuous-integration/travis-ci/push:** The Travis CI build failed ([Details](https://travis-ci.org/easilyBaffled/pid-from-port/builds/468392406?utm_source=github_status&utm_medium=notification)).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.
Mark & Sindre
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:You have a few ways of asserting that the exception is as designed. You can pass a second argument:
message
should be equal to it.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:
This makes tests like these much easier to write:
We've removed promise support from
t.throws()
andt.notThrows()
. Use the newt.throwsAsync()
andt.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()
(ort.notThrows()
). If you have a promise that should reject, or an asynchronous function that should fail, useawait t.throwsAsync()
(orawait t.notThrowsAsync()
).Generally speaking, you should be able to replace every occurence of
await t.throws
withawait t.throwsAsync
, andawait t.notThrows
withawait 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.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:
Whilst not strictly assertions,
t.plan()
andt.log()
are now also bound to the test.BigInt
As part of our Node.js 10 support you can now use
BigInt
values int.deepEqual()
andt.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 atestOptions
object. This will allow us to add source related options in the future.Our
@ava/stage-4
preset is now accessible viaava/stage-4
. We've added transforms for the latest ES2018 features where available (and even an ES2019 one!). You can also disableava/stage-4
entirely:package.json
:Or, you can disable just ES module compilation:
package.json
:The
powerAssert
option and command line flags have been removed. You can now disable AVA's test enhancements by settingcompileEnhancements
tofalse
. You can also disable AVA's Babel pipeline entirely:package.json
: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 usetest.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 fromprocess.argv[2]
onwards.npx ava test.js -- hello world
There's a new recipe on how to use this.
Previously AVA populated
process.argv[2]
andprocess.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 thecache
configuration option.npx ava --reset-cache
Configuration
Introducing
ava.config.js
You can now configure AVA through an
ava.config.js
file. It must be placed next to thepackage.json
, and you mustn't have any"ava"
options in thepackage.json
file. Export the configuration as a default:Or export a factory function:
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 specifybabel.extensions
:package.json
:Or define generic extensions, e.g. for use with TypeScript:
package.json
: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>
int.snapshot()
. We've also improved support for theSymbol.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:
Other improvements
require
configuration.--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.ci-parallel-vars
package for a list of supported CI environments.assert
module in Node.js 10 no longer crashes.process.stderr
is now emulated in the worker processes.--verbose
.<React.Fragment>
can be used int.deepEqual
.title
functions of macros now receiveundefined
rather 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:
Instead all tests must have titles, and they must be unique within the test file:
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:
Modifier chaining
AVA's various test modifiers (
.serial
,.skip
) must now be used in the correct order:.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.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
exportWe're no longer exporting the
test()
method as a named export. Where before you could useimport {test} from 'ava'
, you should now writeimport 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 passundefined
instead. This means you can use default parameters. Here's an example: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()
andt.notThrows()
no longer support observables or promises. For the latter, useawait t.throwsAsync()
andawait t.notThrowsAsync()
instead.Generally speaking, you should be able to replace every occurence of
await t.throws
withawait t.throwsAsync
, andawait t.notThrows
withawait 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.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 ast.falsy()
, so if you were using it please switch tot.falsy()
instead.Configuration changes
The
source
option has been renamed tosources
. This is now consistent withfiles
. AVA will exit with an error if it encounters thesource
option.We've also removed unintentional support for
init
,watch
andupdateSnapshot
options.Babel
The
"default"
and"inherit"
configuration values have been removed. Babel options must now be specified in atestOptions
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 settingcompileEnhancements
tofalse
.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.
t._test
value has been removedOther potential breaking changes
@std/esm
, in favor of the plainesm
package.ava/stage-4
preset is applied after all other plugins and presets.null
as thethis
value.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.--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.async
/await
support.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π
v0.25.0...v1.0.1
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.
783944f
1.0.1
024bab7
1.0.0
aac41dc
Reword introduction
84d8fff
Bump dependencies & update documentation
c1364a1
Update the tagline and readme intro (#1983)
eed2e7a
Clarify that not all configuration options can be overridden by CLI flags
93e91c9
Fix 'sources' option in configuration docs
3bc80b0
Remove moot ESLint disable comment
311c197
Fix snapshot skip interface
0e82b04
1.0.0-rc.2
f97e277
Bump dependencies
6f54db8
Type additional arguments used by macros
a82fee5
Documentation updates
afe028a
CI updates
1ba31d8
Reorganize documentation
There are 218 commits in total.
See the full diff
FAQ and help
There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those donβt help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).Your Greenkeeper Bot :palm_tree: