Skip to content

Commit cbec4cb

Browse files
Update suggested AVA invocation in watch mode recipe
Co-authored-by: Mark Wubben <[email protected]>
1 parent a079152 commit cbec4cb

File tree

1 file changed

+4
-56
lines changed

1 file changed

+4
-56
lines changed

docs/recipes/watch-mode.md

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,13 @@ AVA comes with an intelligent watch mode. It watches for files to change and run
66

77
## Running tests with watch mode enabled
88

9-
You can enable watch mode using the `--watch` or `-w` flags. If you have installed AVA globally:
9+
You can enable watch mode using the `--watch` or `-w` flags:
1010

1111
```console
12-
$ ava --watch
12+
$ npx ava --watch
1313
```
1414

15-
If you've configured it in your `package.json` like this:
16-
17-
```json
18-
{
19-
"scripts": {
20-
"test": "ava"
21-
}
22-
}
23-
```
24-
25-
You can run:
26-
27-
```console
28-
$ npm test -- --watch
29-
```
30-
31-
You could also set up a special script:
32-
33-
```json
34-
{
35-
"scripts": {
36-
"test": "ava",
37-
"watch:test": "ava --watch"
38-
}
39-
}
40-
```
41-
42-
And then use:
43-
44-
```console
45-
$ npm run watch:test
46-
```
47-
48-
Finally you could configure AVA to *always* run in watch mode by setting the `watch` key in the [`ava` section of your `package.json`, or `ava.config.*` file][config].
49-
50-
**`package.json`:**
51-
52-
```json
53-
{
54-
"ava": {
55-
"watch": true
56-
}
57-
}
58-
```
59-
60-
Please note that the TAP reporter is unavailable when using watch mode.
15+
Please note that integrated debugging and the TAP reporter are unavailable when using watch mode.
6116

6217
## Requirements
6318

@@ -98,14 +53,7 @@ You can update failing snapshots by typing <kbd>u</kbd> on the console, followed
9853
Sometimes watch mode does something surprising like rerunning all tests when you thought only a single test would be run. To see its reasoning you can enable a debug mode. This will work best with the verbose reporter:
9954

10055
```console
101-
$ DEBUG=ava:watcher npm test -- --watch --verbose
102-
```
103-
104-
On Windows use:
105-
106-
```console
107-
$ set DEBUG=ava:watcher
108-
$ npm test -- --watch --verbose
56+
$ DEBUG=ava:watcher npx ava --watch
10957
```
11058

11159
## Help us make watch mode better

0 commit comments

Comments
 (0)