Skip to content

Commit 34bebc4

Browse files
LasaleFaminesindresorhus
authored andcommitted
Removed --source CLI flag (#1215)
Fixes #937
1 parent ca016c0 commit 34bebc4

File tree

4 files changed

+4
-9
lines changed

4 files changed

+4
-9
lines changed

docs/recipes/watch-mode.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ In AVA there's a distinction between *source files* and *test files*. As you can
6767

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

70-
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].
70+
You can configure patterns for the source files in the [`ava` section of your `package.json`] file, using the `source` key.
7171

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

74-
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.
74+
If your tests write to disk they may trigger the watcher to rerun your tests. Configure patterns for the source files to avoid this.
7575

7676
## Dependency tracking
7777

@@ -113,7 +113,6 @@ Watch mode is relatively new and there might be some rough edges. Please [report
113113
[`chokidar`]: https://github.com/paulmillr/chokidar
114114
[Install Troubleshooting]: https://github.com/paulmillr/chokidar#install-troubleshooting
115115
[`ignore-by-default`]: https://github.com/novemberborn/ignore-by-default
116-
[`--source` CLI flag]: https://github.com/avajs/ava#cli
117116
[`.only` modifier]: https://github.com/avajs/ava#running-specific-tests
118117
[`ava` section of your `package.json`]: https://github.com/avajs/ava#configuration
119118
[added them in your `package.json`]: https://github.com/avajs/ava#configuration

lib/cli.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ exports.run = () => {
4040
--no-power-assert Disable Power Assert
4141
--match, -m Only run tests with matching title (Can be repeated)
4242
--watch, -w Re-run tests when tests and source files change
43-
--source, -S Pattern to match source files so tests can be re-run (Can be repeated)
4443
--timeout, -T Set global timeout
4544
--concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
4645
--update-snapshots, -u Update snapshots
@@ -59,7 +58,6 @@ exports.run = () => {
5958
string: [
6059
'_',
6160
'match',
62-
'source',
6361
'timeout',
6462
'concurrency'
6563
],
@@ -79,7 +77,6 @@ exports.run = () => {
7977
s: 'serial',
8078
m: 'match',
8179
w: 'watch',
82-
S: 'source',
8380
T: 'timeout',
8481
c: 'concurrency',
8582
u: 'update-snapshots'
@@ -152,7 +149,7 @@ exports.run = () => {
152149

153150
if (cli.flags.watch) {
154151
try {
155-
const watcher = new Watcher(logger, api, files, arrify(cli.flags.source));
152+
const watcher = new Watcher(logger, api, files, arrify(conf.source));
156153
watcher.observeStdin(process.stdin);
157154
} catch (err) {
158155
if (err.name === 'AvaError') {

readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ $ ava --help
161161
--no-power-assert Disable Power Assert
162162
--match, -m Only run tests with matching title (Can be repeated)
163163
--watch, -w Re-run tests when tests and source files change
164-
--source, -S Pattern to match source files so tests can be re-run (Can be repeated)
165164
--timeout, -T Set global timeout
166165
--concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
167166
--update-snapshots, -u Update snapshots

test/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ test('watcher reruns test files when they changed', t => {
238238
test('watcher reruns test files when source dependencies change', t => {
239239
let killed = false;
240240

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

0 commit comments

Comments
 (0)