Skip to content

Commit 9260a70

Browse files
authored
docs: Remove nyc containing object in json config examples (#1276)
1 parent bed4729 commit 9260a70

File tree

1 file changed

+34
-47
lines changed

1 file changed

+34
-47
lines changed

README.md

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ You can then add the specific configuration options you want that aren't in that
7171

7272
```json
7373
{
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
7977
}
8078
```
8179

@@ -184,20 +182,18 @@ Multiple `exclude` globs can be specified on the command line, each must follow
184182
The default `exclude` list is defined in the [@istanbuljs/schema module](https://github.com/istanbuljs/schema/blob/master/default-exclude.js).
185183
Specifying your own exclude property completely replaces these defaults.
186184

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.
188186
It will also exclude any files with the extension `.spec.js`.
189187

190188
```json
191189
{
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+
]
201197
}
202198
```
203199

@@ -209,24 +205,22 @@ To prevent this, wrap each glob in single quotes.
209205
We always add `**/node_modules/**` to the exclude list, even if not specified in the config.
210206
You can override this by setting `--exclude-node-modules=false`.
211207

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.
213209
The set of include rules then restrict nyc to only consider instrumenting files found under the `lib/` and `node_modules/@my-org/` directories.
214210
The exclude rules then prevent nyc instrumenting anything in a `test` folder and the file `node_modules/@my-org/something/unwanted.js`.
215211

216212
```json
217213
{
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
230224
}
231225
```
232226

@@ -274,16 +268,14 @@ You can also change the default cache directory from `./node_modules/.cache/nyc`
274268
## Coverage thresholds
275269

276270
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):
278272

279273
```json
280274
{
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
287279
}
288280
```
289281

@@ -300,13 +292,11 @@ You can specify custom high and low watermarks in nyc's configuration:
300292

301293
```json
302294
{
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]
310300
}
311301
}
312302
```
@@ -326,14 +316,11 @@ hints:
326316

327317
## Ignoring Methods
328318

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.
331320

332321
```json
333322
{
334-
"nyc": {
335-
"ignore-class-method": "render"
336-
}
323+
"ignore-class-method": ["render"]
337324
}
338325
```
339326

0 commit comments

Comments
 (0)