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
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.
5
+
All of the [CLI options][CLI] 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
7
To ignore files, prefix the pattern with an `!` (exclamation mark).
Note that the final configuration must not be a promise.
117
117
118
+
## Alternative configuration files
119
+
120
+
The [CLI] lets you specify a specific configuration file, using the `--config` flag. This file is processed just like an `ava.config.js` file would be. When the `--config` flag is set, the provided file will override all configuration from the `package.json` and `ava.config.js` files. The configuration is not merged.
121
+
122
+
The configuration file *must* be in the same directory as the `package.json` file.
123
+
124
+
You can use this to customize configuration for a specific test run. For instance, you may want to run unit tests separately from integration tests:
125
+
126
+
`ava.config.js`:
127
+
128
+
```js
129
+
exportdefault {
130
+
files: ['unit-tests/**/*']
131
+
};
132
+
```
133
+
134
+
`integration-tests.config.js`:
135
+
136
+
```js
137
+
importbaseConfigfrom'./ava.config.js';
138
+
139
+
exportdefault {
140
+
...baseConfig,
141
+
files: ['integration-tests/**/*']
142
+
};
143
+
```
144
+
145
+
You can now run your unit tests through `npx ava` and the integration tests through `npx ava --config integration-tests.config.js`.
146
+
118
147
## Object printing depth
119
148
120
149
By default, AVA prints nested objects to a depth of `3`. However, when debugging tests with deeply nested objects, it can be useful to print with more detail. This can be done by setting [`util.inspect.defaultOptions.depth`](https://nodejs.org/api/util.html#util_util_inspect_defaultoptions) to the desired depth, before the test is executed:
0 commit comments