Skip to content
Permalink
Browse files

Treat .spec.js files as test files

  • Loading branch information...
novemberborn committed May 5, 2019
1 parent 91b7641 commit 08e99e516e13af75d3ebe70f12194a89b610217c
Showing with 6 additions and 2 deletions.
  1. +2 −1 docs/05-command-line.md
  2. +1 −1 lib/cli.js
  3. +1 −0 lib/globs.js
  4. +1 −0 test/fixture/globs/default-patterns/sub/directory/bar.spec.js
  5. +1 −0 test/globs.js
@@ -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`
@@ -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: {
@@ -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}`,
@@ -0,0 +1 @@
// Empty
@@ -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',

0 comments on commit 08e99e5

Please sign in to comment.
You can’t perform that action at this time.