Skip to content

Commit 3eb0e37

Browse files
AndrewFinlaycoreyfarrell
authored andcommitted
docs: A bunch of docs fix-ups (#1038)
1 parent 5c1eb38 commit 3eb0e37

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ nyc report --reporter=<custom-reporter-name>
200200
nyc runs a lot of file system operations relative to the project root directory.
201201
During startup nyc will look for the *default* project root directory.
202202
The *default* project root directory is the first directory found that contains a `package.json` file when searching from the current working directory up.
203-
If nyc fails to find a directory containing a `package.json` file, it will use current working directory.
203+
If nyc fails to find a directory containing a `package.json` file, it will use current working directory as the *default* project root directory.
204204
You can change the project root directory with the `--cwd` option.
205205

206206
nyc uses the project root directory when:
207-
* looking for source files to cover
207+
* looking for source files to instrument
208208
* creating globs for include and exclude rules during file selection
209209
* loading custom require hooks from the `require` array
210210

@@ -217,34 +217,35 @@ nyc may create artefact directories within the project root, such as:
217217

218218
By default, nyc only collects coverage for source files that are visited during a test.
219219
It does this by watching for files that are `require()`'d during the test.
220+
When a file is `require()`'d, nyc creates and returns an instrumented version of the source, rather than the original.
220221
Only source files that are visited during a test will appear in the coverage report and contribute to coverage statistics.
221222

222223
nyc will instrument all files if the `--all` flag is set.
223224
In this case all files will appear in the coverage report and contribute to coverage statistics.
224225

225-
nyc will only collect coverage for files that are located under `cwd`, and then only `*.js` files or files with extensions listed in in the `extension` array.
226+
nyc will only collect coverage for files that are located under `cwd`, and then only `*.js` files or files with extensions listed in the `extension` array.
226227

227-
You can reduce the set of covered files by adding `include` and `exclude` filter arrays to your config.
228-
These allow you to shape the set of covered files by specifying glob patterns that can filter files from the covered set.
228+
You can reduce the set of instrumented files by adding `include` and `exclude` filter arrays to your config.
229+
These allow you to shape the set of instrumented files by specifying glob patterns that can filter files from the default instrumented set.
229230
The `exclude` array may also use exclude negated glob patterns, these are specified with a `!` prefix, and can restore sub-paths of excluded paths.
230231

231232
Globs are matched using [minimatch](https://www.npmjs.com/package/minimatch).
232233

233234
We use the following process to remove files from consideration:
234-
1. Limit the set of covered files to those files in paths listed in the `include` array.
235+
1. Limit the set of instrumented files to those files in paths listed in the `include` array.
235236
2. Remove any files that are found in the `exclude` array.
236-
3. Restore any exclude negated files that have been excluded in the second step.
237+
3. Restore any exclude negated files that have been excluded in step 2.
237238

238239
### Using include and exclude arrays
239240

240-
If there are paths specified in the `include` array, then the set of covered files will be limited to eligible files found in those paths.
241+
If there are paths specified in the `include` array, then the set of instrumented files will be limited to eligible files found in those paths.
241242
If the `include` array is left undefined all eligible files will be included, equivalent to setting `include: ['**']`.
242-
Include options can be specified on the command line with the `-n` switch.
243+
Multiple `include` globs can be specified on the command line, each must follow a `--include`, `-n` switch.
243244

244-
If there are paths specified in the `exclude` array, then the set of covered files will not feature eligible files found in those paths.
245+
If there are paths specified in the `exclude` array, then the set of instrumented files will not feature eligible files found in those paths.
245246
You can also specify negated paths in the `exclude` array, by prefixing them with a `!`.
246247
Negated paths can restore paths that have been already been excluded in the `exclude` array.
247-
Exclude options can be specified on the command line with the `-x` switch.
248+
Multiple `exclude` globs can be specified on the command line, each must follow a `--exclude`, `-x` switch.
248249

249250
The `exclude` option has the following defaults settings:
250251
```js
@@ -298,7 +299,7 @@ modules should be required in the subprocess collecting coverage:
298299

299300
## Configuring `nyc`
300301

301-
Any configuration options that can be set via the command line can also be specified in the `nyc` stanza of your package.json, or within a `.nycrc` (or `.nycrc.json`) file:
302+
Any configuration options that can be set via the command line can also be specified in the `nyc` stanza of your package.json, or within a `.nycrc`, `.nycrc.json`, or `nyc.config.js` file:
302303

303304
**package.json:**
304305

0 commit comments

Comments
 (0)