Skip to content

Commit

Permalink
Removed --source CLI flag (#1215)
Browse files Browse the repository at this point in the history
Fixes #937
  • Loading branch information
LasaleFamine authored and sindresorhus committed Feb 2, 2017
1 parent ca016c0 commit 34bebc4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
5 changes: 2 additions & 3 deletions docs/recipes/watch-mode.md
Expand Up @@ -67,11 +67,11 @@ In AVA there's a distinction between *source files* and *test files*. As you can

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.

You can configure patterns for the source files in the [`ava` section of your `package.json`] file, using the `source` key. This is the recommended way, though you could also use the [`--source` CLI flag].
You can configure patterns for the source files in the [`ava` section of your `package.json`] file, using the `source` key.

You can specify patterns to match files in the folders that would otherwise be ignored, e.g. use `node_modules/some-dependency/*.js` to specify all `.js` files in `node_modules/some-dependency` as a source, even though normally all files in `node_modules` are ignored. Note that you need to specify an exact directory; `{bower_components,node_modules}/**/*.js` won't work.

If your tests write to disk they may trigger the watcher to rerun your tests. If this occurs you will need to use the `--source` flag.
If your tests write to disk they may trigger the watcher to rerun your tests. Configure patterns for the source files to avoid this.

## Dependency tracking

Expand Down Expand Up @@ -113,7 +113,6 @@ Watch mode is relatively new and there might be some rough edges. Please [report
[`chokidar`]: https://github.com/paulmillr/chokidar
[Install Troubleshooting]: https://github.com/paulmillr/chokidar#install-troubleshooting
[`ignore-by-default`]: https://github.com/novemberborn/ignore-by-default
[`--source` CLI flag]: https://github.com/avajs/ava#cli
[`.only` modifier]: https://github.com/avajs/ava#running-specific-tests
[`ava` section of your `package.json`]: https://github.com/avajs/ava#configuration
[added them in your `package.json`]: https://github.com/avajs/ava#configuration
5 changes: 1 addition & 4 deletions lib/cli.js
Expand Up @@ -40,7 +40,6 @@ exports.run = () => {
--no-power-assert Disable Power Assert
--match, -m Only run tests with matching title (Can be repeated)
--watch, -w Re-run tests when tests and source files change
--source, -S Pattern to match source files so tests can be re-run (Can be repeated)
--timeout, -T Set global timeout
--concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
--update-snapshots, -u Update snapshots
Expand All @@ -59,7 +58,6 @@ exports.run = () => {
string: [
'_',
'match',
'source',
'timeout',
'concurrency'
],
Expand All @@ -79,7 +77,6 @@ exports.run = () => {
s: 'serial',
m: 'match',
w: 'watch',
S: 'source',
T: 'timeout',
c: 'concurrency',
u: 'update-snapshots'
Expand Down Expand Up @@ -152,7 +149,7 @@ exports.run = () => {

if (cli.flags.watch) {
try {
const watcher = new Watcher(logger, api, files, arrify(cli.flags.source));
const watcher = new Watcher(logger, api, files, arrify(conf.source));
watcher.observeStdin(process.stdin);
} catch (err) {
if (err.name === 'AvaError') {
Expand Down
1 change: 0 additions & 1 deletion readme.md
Expand Up @@ -161,7 +161,6 @@ $ ava --help
--no-power-assert Disable Power Assert
--match, -m Only run tests with matching title (Can be repeated)
--watch, -w Re-run tests when tests and source files change
--source, -S Pattern to match source files so tests can be re-run (Can be repeated)
--timeout, -T Set global timeout
--concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
--update-snapshots, -u Update snapshots
Expand Down
2 changes: 1 addition & 1 deletion test/cli.js
Expand Up @@ -238,7 +238,7 @@ test('watcher reruns test files when they changed', t => {
test('watcher reruns test files when source dependencies change', t => {
let killed = false;

const child = execCli(['--verbose', '--watch', '--source=source.js', 'test-*.js'], {dirname: 'fixture/watcher/with-dependencies'}, err => {
const child = execCli(['--verbose', '--watch', 'test-*.js'], {dirname: 'fixture/watcher/with-dependencies'}, err => {
t.ok(killed);
t.ifError(err);
t.end();
Expand Down

0 comments on commit 34bebc4

Please sign in to comment.