
src/foo/foo.test.js
import test from 'ava';
test('foo', t => {
t.pass();
});
src/foo/bar/bar.test.js
import test from 'ava';
test('bar', t => {
t.pass();
});
When doing ava src/**/*.test.js, bar.test.js will not be run:
$ ./node_modules/ava/cli.js src/**/*.test.js --verbose
✔ foo
1 test passed [19:08:56]
The ** should mean any subdirectory underneath in a recursive manner, thus bar.test.js should also be run. Note sure if there are conventions to these things, but I'm used to this behaviour and it seems to be used in node-glob as well:
** If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches. It does not crawl symlinked directories.
No special ava config set.
ava 0.18.2
Node.js v6.9.5
darwin 16.4.0 (macOS Sierra 10.12.3)
node v6.9.5
npm 4.1.2 (yarn v0.20.3)
Try escaping the file pattern:
$ ./node_modules/ava/cli.js 'src/**/*.test.js' --verbose
Most likely your shell is expanding the stars and only matching foo/foo.test.js.
Also, AVA will select these test files by default so you don't need to specify the pattern.
@novemberborn thanks, that fixes it! Could you elaborate on what exactly the shell is doing here? I don't understand that.
Regarding selecting the test files by default, all of my files live in src/ so I'd like ava to look in just that folder.
EDIT: I see what you mean. Simply passing src/ did the trick. Thanks again!
Could you elaborate on what exactly the shell is doing here? I don't understand that.
To be honest I don't have a complete understanding of it either. Under certain conditions it expands the stars, meaning AVA doesn't receive them and can't do its own globbing. Placing the pattern in a string prevents the shell expansion.
Got it...lesson learned! Thanks again.
Most helpful comment
Try escaping the file pattern:
Most likely your shell is expanding the stars and only matching
foo/foo.test.js.Also, AVA will select these test files by default so you don't need to specify the pattern.