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
Copy file name to clipboardExpand all lines: README.md
+34-47Lines changed: 34 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -71,11 +71,9 @@ You can then add the specific configuration options you want that aren't in that
71
71
72
72
```json
73
73
{
74
-
"nyc": {
75
-
"extends": "@istanbuljs/nyc-config-typescript",
76
-
"all": true,
77
-
"check-coverage": true
78
-
}
74
+
"extends": "@istanbuljs/nyc-config-typescript",
75
+
"all": true,
76
+
"check-coverage": true
79
77
}
80
78
```
81
79
@@ -184,20 +182,18 @@ Multiple `exclude` globs can be specified on the command line, each must follow
184
182
The default `exclude` list is defined in the [@istanbuljs/schema module](https://github.com/istanbuljs/schema/blob/master/default-exclude.js).
185
183
Specifying your own exclude property completely replaces these defaults.
186
184
187
-
For example, the following config will collect coverage for every file in the `src` directory regardless of whether it is `require()`'d in a test.
185
+
For example, the following `nyc`config will collect coverage for every file in the `src` directory regardless of whether it is `require()`'d in a test.
188
186
It will also exclude any files with the extension `.spec.js`.
189
187
190
188
```json
191
189
{
192
-
"nyc": {
193
-
"all": true,
194
-
"include": [
195
-
"src/**/*.js"
196
-
],
197
-
"exclude": [
198
-
"**/*.spec.js"
199
-
]
200
-
}
190
+
"all": true,
191
+
"include": [
192
+
"src/**/*.js"
193
+
],
194
+
"exclude": [
195
+
"**/*.spec.js"
196
+
]
201
197
}
202
198
```
203
199
@@ -209,24 +205,22 @@ To prevent this, wrap each glob in single quotes.
209
205
We always add `**/node_modules/**` to the exclude list, even if not specified in the config.
210
206
You can override this by setting `--exclude-node-modules=false`.
211
207
212
-
For example, in the following config, `"excludeNodeModules: false"` will prevent `node_modules` from being added to the exclude rules.
208
+
For example, `"excludeNodeModules: false"` in the following `nyc` config will prevent `node_modules` from being added to the exclude rules.
213
209
The set of include rules then restrict nyc to only consider instrumenting files found under the `lib/` and `node_modules/@my-org/` directories.
214
210
The exclude rules then prevent nyc instrumenting anything in a `test` folder and the file `node_modules/@my-org/something/unwanted.js`.
215
211
216
212
```json
217
213
{
218
-
"nyc": {
219
-
"all": true,
220
-
"include": [
221
-
"lib/**",
222
-
"node_modules/@my-org/**"
223
-
],
224
-
"exclude": [
225
-
"node_modules/@my-org/something/unwanted.js",
226
-
"**/test/**"
227
-
],
228
-
"excludeNodeModules": false
229
-
}
214
+
"all": true,
215
+
"include": [
216
+
"lib/**",
217
+
"node_modules/@my-org/**"
218
+
],
219
+
"exclude": [
220
+
"node_modules/@my-org/something/unwanted.js",
221
+
"**/test/**"
222
+
],
223
+
"excludeNodeModules": false
230
224
}
231
225
```
232
226
@@ -274,16 +268,14 @@ You can also change the default cache directory from `./node_modules/.cache/nyc`
274
268
## Coverage thresholds
275
269
276
270
You can set custom coverage thresholds that will fail if `check-coverage` is set to `true` and your coverage drops below those thresholds.
277
-
For example, in the following configuration, dropping below 80% branch, line, functions, or statements coverage would fail the build (you can have any combination of these):
271
+
For example, in the following `nyc`configuration, dropping below 80% branch, line, functions, or statements coverage would fail the build (you can have any combination of these):
278
272
279
273
```json
280
274
{
281
-
"nyc": {
282
-
"branches": 80,
283
-
"lines": 80,
284
-
"functions": 80,
285
-
"statements": 80
286
-
}
275
+
"branches": 80,
276
+
"lines": 80,
277
+
"functions": 80,
278
+
"statements": 80
287
279
}
288
280
```
289
281
@@ -300,13 +292,11 @@ You can specify custom high and low watermarks in nyc's configuration:
300
292
301
293
```json
302
294
{
303
-
"nyc": {
304
-
"watermarks": {
305
-
"lines": [80, 95],
306
-
"functions": [80, 95],
307
-
"branches": [80, 95],
308
-
"statements": [80, 95]
309
-
}
295
+
"watermarks": {
296
+
"lines": [80, 95],
297
+
"functions": [80, 95],
298
+
"branches": [80, 95],
299
+
"statements": [80, 95]
310
300
}
311
301
}
312
302
```
@@ -326,14 +316,11 @@ hints:
326
316
327
317
## Ignoring Methods
328
318
329
-
There may be some methods that you want to universally ignore out of your classes
330
-
rather than having to ignore every instance of that method:
319
+
You can ignore every instance of a method simply by adding its name to the `ignore-class-method` array in your `nyc` config.
0 commit comments