You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add test to ensure matched test files with the wrong extension are not treated as test files
* Update files and sources configuration docs
* Combine isTest() and isSource()
isSource() calls isTest(), so it's more efficient to classify whether a file is either in a single call.
* Don't rerun tests when detecting changes to files that are not tests, helpers or sources
Since ignore patterns are no longer passed to Chokidar, if a file is not
a test, helper or source, then tests do not need to be re-run.
* Support helper glob configuration
Fixes#2105.
All of the [CLI options](./05-command-line.md) can be configured in the `ava` section of either your `package.json` file, or an `ava.config.js` file. This allows you to modify the default behavior of the `ava` command, so you don't have to repeatedly type the same options on the command prompt.
6
6
7
-
To ignore a file or directory, prefix the pattern with an `!` (exclamation mark).
7
+
To ignore files, prefix the pattern with an `!` (exclamation mark).
8
8
9
9
**`package.json`:**
10
10
11
11
```json
12
12
{
13
13
"ava": {
14
14
"files": [
15
-
"my-test-directory/**/*.js",
16
-
"!my-test-directory/exclude-this-directory",
17
-
"!**/exclude-this-file.js"
15
+
"test/**/*",
16
+
"!test/exclude-files-in-this-directory",
17
+
"!**/exclude-files-with-this-name.*"
18
+
],
19
+
"helpers": [
20
+
"**/helpers/**/*"
18
21
],
19
22
"sources": [
20
-
"**/*.{js,jsx}",
21
-
"!dist"
23
+
"src/**/*"
22
24
],
23
25
"match": [
24
26
"*oo",
@@ -35,7 +37,7 @@ To ignore a file or directory, prefix the pattern with an `!` (exclamation mark)
35
37
"@babel/register"
36
38
],
37
39
"babel": {
38
-
"extensions": ["jsx"],
40
+
"extensions": ["js", "jsx"],
39
41
"testOptions": {
40
42
"babelrc": false
41
43
}
@@ -48,8 +50,9 @@ Arguments passed to the CLI will always take precedence over the CLI options con
48
50
49
51
## Options
50
52
51
-
-`files`: glob patterns that select which files AVA will run tests from. Files with an underscore prefix are ignored. By default only selects files with `js` extensions, even if the glob pattern matches other files. Specify `extensions` and `babel.extensions` to allow other file extensions
52
-
-`sources`: files that, when changed, cause tests to be re-run in watch mode. See the [watch mode recipe for details](https://github.com/avajs/ava/blob/master/docs/recipes/watch-mode.md#source-files-and-test-files)
53
+
-`files`: an array of glob patterns to select test files. Files with an underscore prefix are ignored. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` and `babel.extensions` to allow other file extensions
54
+
-`helpers`: an array of glob patterns to select helper files. Files matched here are never considered as tests. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` and `babel.extensions` to allow other file extensions
55
+
-`sources`: an array of glob patterns to match files that, when changed, cause tests to be re-run (when in watch mode). See the [watch mode recipe for details](https://github.com/avajs/ava/blob/master/docs/recipes/watch-mode.md#source-files-and-test-files)
53
56
-`match`: not typically useful in the `package.json` configuration, but equivalent to [specifying `--match` on the CLI](./05-command-line.md#running-tests-with-matching-titles)
54
57
-`cache`: cache compiled test and helper files under `node_modules/.cache/ava`. If `false`, files are cached in a temporary directory instead
55
58
-`failFast`: stop running further tests once a test fails
0 commit comments