Skip to content

Commit b6123c1

Browse files
novemberbornkevva
authored andcommitted
Automatically watch for snapshot changes
1 parent b3cf3f2 commit b6123c1

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

docs/recipes/watch-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ AVA uses [`chokidar`] as the file watcher. Note that even if you see warnings ab
6565

6666
In AVA there's a distinction between *source files* and *test files*. As you can imagine the *test files* contain your tests. *Source files* are all other files that are needed for the tests to run, be it your source code or test fixtures.
6767

68-
By default AVA watches for changes to the test files, `package.json`, and any other `.js` files. It'll ignore files in [certain directories](https://github.com/novemberborn/ignore-by-default/blob/master/index.js) as provided by the [`ignore-by-default`] package.
68+
By default AVA watches for changes to the test files, snapshot files, `package.json`, and any other `.js` files. It'll ignore files in [certain directories](https://github.com/novemberborn/ignore-by-default/blob/master/index.js) as provided by the [`ignore-by-default`] package.
6969

7070
You can configure patterns for the source files in the [`ava` section of your `package.json`] file, using the `source` key.
7171

lib/ava-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class AvaFiles {
265265
ignored = getDefaultIgnorePatterns().concat(ignored, overrideDefaultIgnorePatterns);
266266

267267
if (paths.length === 0) {
268-
paths = ['package.json', '**/*.js'];
268+
paths = ['package.json', '**/*.js', '**/*.snap'];
269269
}
270270

271271
paths = paths.concat(this.files);

test/fixture/snapshots/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"ava": {
3-
"source": "**/*"
4-
}
5-
}
1+
{}

test/watcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ group('chokidar', (beforeEach, test, group) => {
161161

162162
t.ok(chokidar.watch.calledOnce);
163163
t.strictDeepEqual(chokidar.watch.firstCall.args, [
164-
['package.json', '**/*.js'].concat(files),
164+
['package.json', '**/*.js', '**/*.snap'].concat(files),
165165
{
166166
ignored: defaultIgnore.map(dir => `${dir}/**/*`),
167167
ignoreInitial: true

0 commit comments

Comments
 (0)