Skip to content

Commit ac99234

Browse files
docs: add missing description for --exclude-after-remap (#413)
1 parent 7731574 commit ac99234

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Here is a list of common options. Run `c8 --help` for the full list and document
3636
| `--src` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | `[process.cwd()]`|
3737
| `-n`, `--include` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | `[]` (include all files) |
3838
| `-x`, `--exclude` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array<string>` | [list](https://github.com/istanbuljs/schema/blob/master/default-exclude.js) |
39+
| `--exclude-after-remap` | see [section below](#exclude-after-remap) for more info | `boolean` | `false` |
3940
| `-e`, `--extension` | only files matching these extensions will show coverage | `string \| Array<string>` | [list](https://github.com/istanbuljs/schema/blob/master/default-extension.js) |
4041
| `--skip-full` | do not show files with 100% statement, branch, and function coverage | `boolean` | `false` |
4142
| `--check-coverage` | check whether coverage is within thresholds provided | `boolean` | `false` |
@@ -53,6 +54,24 @@ By supplying `--all` to c8, all files in directories specified with `--src` (def
5354
and `--exclude` flag checks, will be loaded into the report. If any of those files remain uncovered they will be factored
5455
into the report with a default of 0% coverage.
5556

57+
## SourceMap Support
58+
59+
`c8` can handle source-maps, for remapping coverage from generated code to original source files (_useful for TypeScript, JSX, etc_).
60+
61+
### Source map files versus inline source maps
62+
63+
Just-in-time instrumented codebases will often insert source maps inline with the `.js` code they generate at runtime (e.g, `@babel/register` can be configured to insert a source map footer).
64+
65+
Pre-instrumented codebases, e.g., running `tsc` to generate `.js` in a build folder, may generate either inline source maps, or a separate `.map` file stored on disk.
66+
67+
`c8` can handle loading both types of source maps.
68+
69+
### Exclude after remap
70+
71+
Depending on the size and configuration of your project, it may be preferable to apply exclusion logic either before or after source-maps are used to remap compiled to original source files.
72+
73+
`--exclude-after-remap` is used to control this behaviour.
74+
5675
## c8 report
5776

5877
run `c8 report` to regenerate reports after `c8` has already been run.

0 commit comments

Comments
 (0)