diff --git a/docs/05-command-line.md b/docs/05-command-line.md index bc0b191d4..a1ca86e31 100644 --- a/docs/05-command-line.md +++ b/docs/05-command-line.md @@ -30,7 +30,7 @@ $ npx ava --help The above relies on your shell expanding the glob patterns. Without arguments, AVA uses the following patterns: - **/test.js **/test-*.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js + **/test.js **/test-*.js **/*.spec.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js ``` *Note that the CLI will use your local install of AVA when available, even when run globally.* @@ -39,6 +39,7 @@ AVA searches for test files using the following patterns: * `**/test.js` * `**/test-*.js` +* `**/*.spec.js` * `**/*.test.js` * `**/test/**/*.js` * `**/__tests__/**/*.js` diff --git a/lib/cli.js b/lib/cli.js index 3a7bb558f..a58b5718d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -52,7 +52,7 @@ exports.run = async () => { // eslint-disable-line complexity The above relies on your shell expanding the glob patterns. Without arguments, AVA uses the following patterns: - **/test.js **/test-*.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js + **/test.js **/test-*.js **/*.spec.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js `, { flags: { watch: { diff --git a/lib/globs.js b/lib/globs.js index 2a9cd6048..9cae32270 100644 --- a/lib/globs.js +++ b/lib/globs.js @@ -40,6 +40,7 @@ function normalizeGlobs(testPatterns, sourcePatterns, extensions) { const extensionPattern = buildExtensionPattern(extensions); const defaultTestPatterns = [ `**/__tests__/**/*.${extensionPattern}`, + `**/*.spec.${extensionPattern}`, `**/*.test.${extensionPattern}`, `**/test-*.${extensionPattern}`, `**/test.${extensionPattern}`, diff --git a/test/fixture/globs/default-patterns/sub/directory/bar.spec.js b/test/fixture/globs/default-patterns/sub/directory/bar.spec.js new file mode 100644 index 000000000..d15abba59 --- /dev/null +++ b/test/fixture/globs/default-patterns/sub/directory/bar.spec.js @@ -0,0 +1 @@ +// Empty diff --git a/test/globs.js b/test/globs.js index b326bca69..7bf4569e5 100644 --- a/test/globs.js +++ b/test/globs.js @@ -108,6 +108,7 @@ test('findHelpersAndTests finds tests (just .js)', async t => { const expected = [ 'sub/directory/__tests__/foo.js', + 'sub/directory/bar.spec.js', 'sub/directory/bar.test.js', 'test-foo.js', 'test.js',