diff --git a/docs/recipes/watch-mode.md b/docs/recipes/watch-mode.md index d4e764007..800d72e69 100644 --- a/docs/recipes/watch-mode.md +++ b/docs/recipes/watch-mode.md @@ -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. diff --git a/lib/ava-files.js b/lib/ava-files.js index dd9a2ee6d..cfdc9f202 100644 --- a/lib/ava-files.js +++ b/lib/ava-files.js @@ -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); diff --git a/test/fixture/snapshots/package.json b/test/fixture/snapshots/package.json index 2213e8988..0967ef424 100644 --- a/test/fixture/snapshots/package.json +++ b/test/fixture/snapshots/package.json @@ -1,5 +1 @@ -{ - "ava": { - "source": "**/*" - } -} +{} diff --git a/test/watcher.js b/test/watcher.js index a82c8aa1a..a5cc2bba7 100644 --- a/test/watcher.js +++ b/test/watcher.js @@ -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