Skip to content

Commit 08e99e5

Browse files
committedMay 5, 2019
Treat .spec.js files as test files
1 parent 91b7641 commit 08e99e5

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed
 

‎docs/05-command-line.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $ npx ava --help
3030

3131
The above relies on your shell expanding the glob patterns.
3232
Without arguments, AVA uses the following patterns:
33-
**/test.js **/test-*.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js
33+
**/test.js **/test-*.js **/*.spec.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js
3434
```
3535

3636
*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:
3939

4040
* `**/test.js`
4141
* `**/test-*.js`
42+
* `**/*.spec.js`
4243
* `**/*.test.js`
4344
* `**/test/**/*.js`
4445
* `**/__tests__/**/*.js`

‎lib/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ exports.run = async () => { // eslint-disable-line complexity
5252
5353
The above relies on your shell expanding the glob patterns.
5454
Without arguments, AVA uses the following patterns:
55-
**/test.js **/test-*.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js
55+
**/test.js **/test-*.js **/*.spec.js **/*.test.js **/test/**/*.js **/__tests__/**/*.js
5656
`, {
5757
flags: {
5858
watch: {

‎lib/globs.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function normalizeGlobs(testPatterns, sourcePatterns, extensions) {
4040
const extensionPattern = buildExtensionPattern(extensions);
4141
const defaultTestPatterns = [
4242
`**/__tests__/**/*.${extensionPattern}`,
43+
`**/*.spec.${extensionPattern}`,
4344
`**/*.test.${extensionPattern}`,
4445
`**/test-*.${extensionPattern}`,
4546
`**/test.${extensionPattern}`,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Empty

‎test/globs.js

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ test('findHelpersAndTests finds tests (just .js)', async t => {
108108

109109
const expected = [
110110
'sub/directory/__tests__/foo.js',
111+
'sub/directory/bar.spec.js',
111112
'sub/directory/bar.test.js',
112113
'test-foo.js',
113114
'test.js',

0 commit comments

Comments
 (0)
Please sign in to comment.