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
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,7 @@ Here is a list of common options. Run `c8 --help` for the full list and document
36
36
|`--src`| see [section below](#checking-for-full-source-coverage-using---all) for more info |`Array<string>`|`[process.cwd()]`|
37
37
|`-n`, `--include`| see [section below](#checking-for-full-source-coverage-using---all) for more info |`Array<string>`|`[]` (include all files) |
38
38
|`-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`|
39
40
|`-e`, `--extension`| only files matching these extensions will show coverage |`string \| Array<string>`|[list](https://github.com/istanbuljs/schema/blob/master/default-extension.js)|
40
41
|`--skip-full`| do not show files with 100% statement, branch, and function coverage |`boolean`|`false`|
41
42
|`--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
53
54
and `--exclude` flag checks, will be loaded into the report. If any of those files remain uncovered they will be factored
54
55
into the report with a default of 0% coverage.
55
56
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
+
56
75
## c8 report
57
76
58
77
run `c8 report` to regenerate reports after `c8` has already been run.
0 commit comments