From 68acd0de02362a6721dc21380e9e1bc58d396dbe Mon Sep 17 00:00:00 2001 From: liyidong Date: Mon, 18 Jul 2022 01:05:08 +0800 Subject: [PATCH 1/5] docs: add missing description for --exclude-after-remap --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 5e122865..0625834d 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Here is a list of common options. Run `c8 --help` for the full list and document | `--src` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array` | `[process.cwd()]`| | `-n`, `--include` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array` | `[]` (include all files) | | `-x`, `--exclude` | see [section below](#checking-for-full-source-coverage-using---all) for more info | `Array` | [list](https://github.com/istanbuljs/schema/blob/master/default-exclude.js) | +| `--exclude-after-remap` | see [section below](#exclude-after-remap) for more info | `boolean` | `false` | | `-e`, `--extension` | only files matching these extensions will show coverage | `string \| Array` | [list](https://github.com/istanbuljs/schema/blob/master/default-extension.js) | | `--skip-full` | do not show files with 100% statement, branch, and function coverage | `boolean` | `false` | | `--check-coverage` | check whether coverage is within thresholds provided | `boolean` | `false` | @@ -53,6 +54,22 @@ By supplying `--all` to c8, all files in directories specified with `--src` (def and `--exclude` flag checks, will be loaded into the report. If any of those files remain uncovered they will be factored into the report with a default of 0% coverage. +## Pre-instrumented versus just-in-time instrumented codebases + +### Source map files versus inline source maps + +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 foote). + +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. + +`c8` can handle loading both types of source maps. + +### Exclude after remap + +For independent projects, feel free to set `--exclude-after-remap` as `true` or `false`, the only difference is that the exclusions are applied to _**source**_ scripts or _**executable**_ scripts. + +For huge 'shared codebase' such as monorepo, your test suites can use common libs as workspace node_modules and _**executable**_ scripts is a single bundle, set `--exclude-after-remap` to true may help to set exclusions more precisely. + ## c8 report run `c8 report` to regenerate reports after `c8` has already been run. From 4f6f6dfef027d86def455ce43c96b946046a3464 Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 19 Jul 2022 11:47:20 -0400 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0625834d..ad911f95 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ into the report with a default of 0% coverage. ### Source map files versus inline source maps -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 foote). +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). 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. From 7c408a96ec3da2c34a7db2cd088818692ca0eea3 Mon Sep 17 00:00:00 2001 From: Yidong Li Date: Wed, 20 Jul 2022 00:01:45 +0800 Subject: [PATCH 3/5] Update README.md Co-authored-by: Benjamin E. Coe --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ad911f95..33789ded 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,9 @@ Pre-instrumented codebases, e.g., running `tsc` to generate `.js` in a build fol ### Exclude after remap -For independent projects, feel free to set `--exclude-after-remap` as `true` or `false`, the only difference is that the exclusions are applied to _**source**_ scripts or _**executable**_ scripts. +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. -For huge 'shared codebase' such as monorepo, your test suites can use common libs as workspace node_modules and _**executable**_ scripts is a single bundle, set `--exclude-after-remap` to true may help to set exclusions more precisely. +`--exclude-after-remap` is used to control this behaviour. ## c8 report From 4bcd0764c35447642cee2d23ab0bbf8bcddcdab8 Mon Sep 17 00:00:00 2001 From: Yidong Li Date: Wed, 20 Jul 2022 00:01:58 +0800 Subject: [PATCH 4/5] Update README.md Co-authored-by: Benjamin E. Coe --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 33789ded..56d911d5 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,9 @@ By supplying `--all` to c8, all files in directories specified with `--src` (def and `--exclude` flag checks, will be loaded into the report. If any of those files remain uncovered they will be factored into the report with a default of 0% coverage. -## Pre-instrumented versus just-in-time instrumented codebases +## SourceMap Support + +`c8` can handle source-maps, for remapping coverage from generated code to original source files (_useful for TypeScript, JSX, etc). ### Source map files versus inline source maps From b2070dad34e01535da900cc861f230916be0a24d Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Tue, 19 Jul 2022 12:20:17 -0400 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 56d911d5..71ef8a36 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ into the report with a default of 0% coverage. ## SourceMap Support -`c8` can handle source-maps, for remapping coverage from generated code to original source files (_useful for TypeScript, JSX, etc). +`c8` can handle source-maps, for remapping coverage from generated code to original source files (_useful for TypeScript, JSX, etc_). ### Source map files versus inline source maps