Skip to content

Commit

Permalink
Automatically watch for snapshot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed Jun 25, 2017
1 parent a141033 commit 87eef84
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/recipes/watch-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ AVA uses [`chokidar`] as the file watcher. Note that even if you see warnings ab

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.

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.
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.

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

Expand Down
2 changes: 1 addition & 1 deletion lib/ava-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class AvaFiles {
ignored = getDefaultIgnorePatterns().concat(ignored, overrideDefaultIgnorePatterns);

if (paths.length === 0) {
paths = ['package.json', '**/*.js'];
paths = ['package.json', '**/*.js', '**/*.snap'];
}

paths = paths.concat(this.files);
Expand Down
6 changes: 1 addition & 5 deletions test/fixture/snapshots/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
{
"ava": {
"source": "**/*"
}
}
{}
2 changes: 1 addition & 1 deletion test/watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ group('chokidar', (beforeEach, test, group) => {

t.ok(chokidar.watch.calledOnce);
t.strictDeepEqual(chokidar.watch.firstCall.args, [
['package.json', '**/*.js'].concat(files),
['package.json', '**/*.js', '**/*.snap'].concat(files),
{
ignored: defaultIgnore.map(dir => `${dir}/**/*`),
ignoreInitial: true
Expand Down

0 comments on commit 87eef84

Please sign in to comment.