You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove obsolete recipes
ES modules is supported out of the box.
The React recipe applies to AVA 3.
* Remove code guards against obsolete API usage
* Remove references to older AVA versions from documentation
Copy file name to clipboardexpand all lines: docs/01-writing-tests.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ AVA tries to run test files with their current working directory set to the dire
10
10
11
11
## Test isolation
12
12
13
-
Each test file is run in a new worker thread. This is new as of AVA 4, though you can fall back to AVA 3's behavior of running in separate processes.
13
+
By default each test file is run in a new worker thread. You can fall back running in separate processes.
14
14
15
15
AVA will set `process.env.NODE_ENV` to `test`, unless the `NODE_ENV` environment variable has been set. This is useful if the code you're testing has test defaults (for example when picking what database to connect to). It may cause your code or its dependencies to behave differently though. Note that `'NODE_ENV' in process.env` will always be `true`.
Copy file name to clipboardexpand all lines: docs/03-assertions.md
+5-7
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,11 @@ test('unicorns are truthy', t => {
21
21
22
22
If multiple assertion failures are encountered within a single test, AVA will only display the *first* one.
23
23
24
-
In AVA 6, assertions return `true` if they've passed and throw otherwise. Catching this error does not cause the test to pass. The error value is undocumented.
25
-
26
-
In AVA 5, assertions return a boolean and do not throw. You can use this to return early from a test. The `snapshot()` assertion does not return a value.
24
+
Assertions return `true` if they've passed and throw otherwise. Catching this error does not cause the test to pass. The error value is undocumented.
27
25
28
26
If you use TypeScript you can use some assertions as type guards.
29
27
30
-
Note that the "throws" assertions return the error that was thrown (provided the assertion passed). In AVA 5, they return `undefined` if the assertion failed.
28
+
Note that the "throws" assertions return the error that was thrown (provided the assertion passed).
Assert that an error is thrown. `fn` must be a function which should throw. By default, the thrown value *must* be an error. It is returned so you can run more assertions against it.
180
178
`expectation` can be an object with one or more of the following properties:
181
179
182
-
*`any`: a boolean only available in AVA 6, if `true` then the thrown value does not need to be an error. Defaults to `false`
180
+
*`any`: a boolean, if `true` then the thrown value does not need to be an error. Defaults to `false`
183
181
*`instanceOf`: a constructor, the thrown error must be an instance of
184
182
*`is`: the thrown error must be strictly equal to `expectation.is`
185
183
*`message`: the following types are valid:
@@ -214,7 +212,7 @@ Assert that an error is thrown. `thrower` can be an async function which should
214
212
By default, the thrown value *must* be an error. It is returned so you can run more assertions against it.
215
213
`expectation` can be an object with one or more of the following properties:
216
214
217
-
*`any`: a boolean only available in AVA 6, if `true` then the thrown value does not need to be an error. Defaults to `false`
215
+
*`any`: a boolean, if `true` then the thrown value does not need to be an error. Defaults to `false`
218
216
*`instanceOf`: a constructor, the thrown error must be an instance of
219
217
*`is`: the thrown error must be strictly equal to `expectation.is`
220
218
*`message`: the following types are valid:
@@ -279,7 +277,7 @@ Compares the `expected` value with a previously recorded snapshot. Snapshots are
279
277
280
278
The implementation function behaves the same as any other test function. You can even use macros. The first title argument is always optional. Additional arguments are passed to the implementation or macro function.
281
279
282
-
`.try()` is an asynchronous function. You must `await` it. The result object has `commit()` and `discard()` methods. You must decide whether to commit or discard the result. If you commit a failed result, your test will fail. In AVA 6, calling`commit()` on a failed result will throw an error.
280
+
`.try()` is an asynchronous function. You must `await` it. The result object has `commit()` and `discard()` methods. You must decide whether to commit or discard the result. If you commit a failed result, your test will fail. Calling`commit()` on a failed result will throw an error.
283
281
284
282
You can check whether the attempt passed using the `passed` property. Any assertion errors are available through the `errors` property. The attempt title is available through the `title` property.
Copy file name to clipboardexpand all lines: docs/recipes/watch-mode.md
+3-9
Original file line number
Diff line number
Diff line change
@@ -16,17 +16,13 @@ Please note that integrated debugging and the TAP reporter are unavailable when
16
16
17
17
## Requirements
18
18
19
-
AVA 5 uses [`chokidar`] as the file watcher. Note that even if you see warnings about optional dependencies failing during install, it will still work fine. Please refer to the *[Install Troubleshooting]* section of `chokidar` documentation for how to resolve the installation problems with chokidar.
20
-
21
-
Otherwise, AVA 6 uses `fs.watch()`. Support for `recursive` mode is required. Note that this has only become available on Linux since Node.js 20. [Other caveats apply](https://nodejs.org/api/fs.html#caveats), for example this won't work well on network filesystems and Docker host mounts.
19
+
AVA uses `fs.watch()`. Support for `recursive` mode is required. Note that this has only become available on Linux since Node.js 20. [Other caveats apply](https://nodejs.org/api/fs.html#caveats), for example this won't work well on network filesystems and Docker host mounts.
22
20
23
21
## Ignoring changes
24
22
25
23
By default AVA watches for changes to all files, except for those with a `.snap.md` extension, `ava.config.*` and files in [certain directories](https://github.com/novemberborn/ignore-by-default/blob/master/index.js) as provided by the [`ignore-by-default`] package.
26
24
27
-
With AVA 5, you can configure additional patterns for files to ignore in the [`ava` section of your `package.json`, or `ava.config.*` file][config], using the `ignoredByWatcher` key.
28
-
29
-
With AVA 6, place these patterns within the `watchMode` object:
25
+
You can configure additional patterns for files to ignore in the [`ava` section of your `package.json`, or `ava.config.*` file][config], using the `ignoreChanges` key within the `watchMode` object:
30
26
31
27
```js
32
28
exportdefault {
@@ -42,9 +38,7 @@ If your tests write to disk they may trigger the watcher to rerun your tests. Co
42
38
43
39
AVA tracks which source files your test files depend on. If you change such a dependency only the test file that depends on it will be rerun. AVA will rerun all tests if it cannot determine which test file depends on the changed source file.
44
40
45
-
AVA 5 spies on `require()` calls to track dependencies. Custom extensions and transpilers are supported, provided you [added them in your `package.json` or `ava.config.*` file][config], and not from inside your test file.
46
-
47
-
With AVA 6, dependency tracking works for `require()` and `import` syntax, as supported by [@vercel/nft](https://github.com/vercel/nft). `import()` is supported but dynamic paths such as `import(myVariable)` are not.
41
+
Dependency tracking works for `require()` and `import` syntax, as supported by [@vercel/nft](https://github.com/vercel/nft). `import()` is supported but dynamic paths such as `import(myVariable)` are not.
48
42
49
43
Files accessed using the `fs` module are not tracked.
0 commit comments