monocart-coverage-reports 2.10.9 โ 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -17
- package/README.zh-Hans.md +30 -16
- package/lib/cli.js +15 -0
- package/lib/converter/converter.js +1 -1
- package/lib/converter/flatten-source-maps.js +1 -1
- package/lib/converter/untested.js +315 -315
- package/lib/default/options.js +3 -0
- package/lib/generate.js +59 -25
- package/lib/index.d.ts +9 -0
- package/lib/index.js +5 -2
- package/lib/istanbul/istanbul.js +6 -2
- package/lib/packages/monocart-coverage-vendor.js +23 -23
- package/lib/reports/raw.js +85 -3
- package/lib/utils/dedupe.js +8 -3
- package/lib/utils/gc.js +9 -0
- package/lib/utils/merge/merge.js +439 -0
- package/lib/utils/merge/range-tree.js +123 -0
- package/lib/utils/util.js +36 -3
- package/lib/v8/v8.js +29 -20
- package/package.json +118 -115
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Monocart Coverage Reports
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
4
|
-
|
|
5
|
-
](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
[](https://packagephobia.com/result?p=monocart-coverage-reports)
|
|
7
|
+
[](https://npmgraph.js.org/?q=monocart-coverage-reports)
|
|
8
|
+

|
|
9
|
+
[](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
8
10
|
|
|
9
11
|
๐ English | [็ฎไฝไธญๆ](README.zh-Hans.md)
|
|
10
12
|
|
|
@@ -53,8 +55,7 @@
|
|
|
53
55
|
- [TestCafe](#testcafe)
|
|
54
56
|
- [Selenium Webdriver](#selenium-webdriver)
|
|
55
57
|
- [Mocha](#mocha)
|
|
56
|
-
- [
|
|
57
|
-
- [ts-node](#ts-node)
|
|
58
|
+
- [TypeScript](#typescript)
|
|
58
59
|
- [AVA](#ava)
|
|
59
60
|
- [Codecov](#codecov)
|
|
60
61
|
- [Codacy](#codacy)
|
|
@@ -486,6 +487,16 @@ export interface ScriptCoverage {
|
|
|
486
487
|
export type V8CoverageData = ScriptCoverage[];
|
|
487
488
|
```
|
|
488
489
|
|
|
490
|
+
| JavaScript Runtime | V8 Coverage | |
|
|
491
|
+
| :--------------| :----: | :---------------------- |
|
|
492
|
+
| Chrome (65%) | โ
| Chromium-based |
|
|
493
|
+
| Safari (18%) | โ | |
|
|
494
|
+
| Edge (5%) | โ
| Chromium-based |
|
|
495
|
+
| Firefox (2%) | โ | |
|
|
496
|
+
| Node.js | โ
| |
|
|
497
|
+
| Deno | โ | [issue](https://github.com/denoland/deno/issues/23359) |
|
|
498
|
+
| Bun | โ | |
|
|
499
|
+
|
|
489
500
|
## Filtering Results
|
|
490
501
|
### Using `entryFilter` and `sourceFilter` to filter the results for V8 report
|
|
491
502
|
When V8 coverage data collected, it actually contains the data of all entry files, for example:
|
|
@@ -776,8 +787,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js
|
|
|
776
787
|
|
|
777
788
|
- Examples
|
|
778
789
|
- [Mocha](#mocha)
|
|
779
|
-
- [
|
|
780
|
-
- [ts-node](#ts-node)
|
|
790
|
+
- [TypeScript](#typescript)
|
|
781
791
|
- [AVA](#ava)
|
|
782
792
|
|
|
783
793
|
## Config File
|
|
@@ -1034,19 +1044,22 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js
|
|
|
1034
1044
|
```sh
|
|
1035
1045
|
mcr mocha ./test/**/*.js
|
|
1036
1046
|
```
|
|
1047
|
+
|
|
1048
|
+
### [TypeScript](https://github.com/microsoft/typescript)
|
|
1049
|
+
|
|
1050
|
+
- [tsx](https://github.com/privatenumber/tsx)
|
|
1037
1051
|
```sh
|
|
1052
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts
|
|
1053
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts
|
|
1054
|
+
# Node.js v18.19.0 +
|
|
1055
|
+
mcr --import tsx tsx ./src/example.ts
|
|
1038
1056
|
mcr --import tsx mocha ./test/**/*.ts
|
|
1039
1057
|
```
|
|
1040
|
-
-
|
|
1041
|
-
|
|
1042
|
-
### [tsx](https://github.com/privatenumber/tsx)
|
|
1058
|
+
- [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1043
1059
|
```sh
|
|
1044
|
-
|
|
1060
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts
|
|
1061
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts
|
|
1045
1062
|
```
|
|
1046
|
-
- see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
|
|
1047
|
-
|
|
1048
|
-
### [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1049
|
-
- see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node)
|
|
1050
1063
|
|
|
1051
1064
|
### [AVA](https://github.com/avajs/ava)
|
|
1052
1065
|
```sh
|
package/README.zh-Hans.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Monocart Coverage Reports
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
4
|
-
|
|
5
|
-
](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
[](https://packagephobia.com/result?p=monocart-coverage-reports)
|
|
7
|
+
[](https://npmgraph.js.org/?q=monocart-coverage-reports)
|
|
8
|
+

|
|
9
|
+
[](https://www.npmjs.com/package/monocart-coverage-reports)
|
|
8
10
|
|
|
9
11
|
๐ [English](README.md) | ็ฎไฝไธญๆ
|
|
10
12
|
|
|
@@ -53,8 +55,7 @@
|
|
|
53
55
|
- [TestCafe](#testcafe)
|
|
54
56
|
- [Selenium Webdriver](#selenium-webdriver)
|
|
55
57
|
- [Mocha](#mocha)
|
|
56
|
-
- [
|
|
57
|
-
- [ts-node](#ts-node)
|
|
58
|
+
- [TypeScript](#typescript)
|
|
58
59
|
- [AVA](#ava)
|
|
59
60
|
- [Codecov](#codecov)
|
|
60
61
|
- [Codacy](#codacy)
|
|
@@ -490,6 +491,16 @@ export interface ScriptCoverage {
|
|
|
490
491
|
export type V8CoverageData = ScriptCoverage[];
|
|
491
492
|
```
|
|
492
493
|
|
|
494
|
+
| JavaScript Runtime | V8 Coverage | |
|
|
495
|
+
| :--------------| :----: | :---------------------- |
|
|
496
|
+
| Chrome (65%) | โ
| Chromium-based |
|
|
497
|
+
| Safari (18%) | โ | |
|
|
498
|
+
| Edge (5%) | โ
| Chromium-based |
|
|
499
|
+
| Firefox (2%) | โ | |
|
|
500
|
+
| Node.js | โ
| |
|
|
501
|
+
| Deno | โ | [issue](https://github.com/denoland/deno/issues/23359) |
|
|
502
|
+
| Bun | โ | |
|
|
503
|
+
|
|
493
504
|
## Filtering Results
|
|
494
505
|
## Using `entryFilter` and `sourceFilter` to filter the results for V8 report
|
|
495
506
|
ๅฝๆถ้ๅฐV8็่ฆ็ๆฐๆฎๆถ๏ผๅฎๅฎ้
ไธๅ
ๅซไบๆๆ็ๅ
ฅๅฃๆไปถ็่ฆ็็ๆฐๆฎ, ๆฏๅฆๆไปฅไธ3ไธชๆไปถ:
|
|
@@ -779,8 +790,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js
|
|
|
779
790
|
|
|
780
791
|
- ๅ่งไพๅญ
|
|
781
792
|
- [Mocha](#mocha)
|
|
782
|
-
- [
|
|
783
|
-
- [ts-node](#ts-node)
|
|
793
|
+
- [TypeScript](#typescript)
|
|
784
794
|
- [AVA](#ava)
|
|
785
795
|
|
|
786
796
|
## Config File
|
|
@@ -1038,19 +1048,23 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js
|
|
|
1038
1048
|
```sh
|
|
1039
1049
|
mcr mocha ./test/**/*.js
|
|
1040
1050
|
```
|
|
1051
|
+
|
|
1052
|
+
### [TypeScript](https://github.com/microsoft/typescript)
|
|
1053
|
+
|
|
1054
|
+
- [tsx](https://github.com/privatenumber/tsx)
|
|
1041
1055
|
```sh
|
|
1056
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts
|
|
1057
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts
|
|
1058
|
+
# Node.js v18.19.0 +
|
|
1059
|
+
mcr --import tsx tsx ./src/example.ts
|
|
1042
1060
|
mcr --import tsx mocha ./test/**/*.ts
|
|
1043
1061
|
```
|
|
1044
|
-
-
|
|
1045
|
-
|
|
1046
|
-
### [tsx](https://github.com/privatenumber/tsx)
|
|
1062
|
+
- [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1047
1063
|
```sh
|
|
1048
|
-
|
|
1064
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts
|
|
1065
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts
|
|
1049
1066
|
```
|
|
1050
|
-
- see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
|
|
1051
1067
|
|
|
1052
|
-
### [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1053
|
-
- see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node)
|
|
1054
1068
|
|
|
1055
1069
|
### [AVA](https://github.com/avajs/ava)
|
|
1056
1070
|
```sh
|
package/lib/cli.js
CHANGED
|
@@ -65,8 +65,21 @@ const checkRegisterFeature = () => {
|
|
|
65
65
|
return true;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
const loadEnv = (cliOptions) => {
|
|
69
|
+
if (!cliOptions.env) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const envFile = cliOptions.env === true ? '.env' : cliOptions.env;
|
|
73
|
+
const loadEnvFile = process.loadEnvFile;
|
|
74
|
+
if (typeof loadEnvFile === 'function') {
|
|
75
|
+
loadEnvFile(envFile);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
68
79
|
const initNodeOptions = async (cliOptions) => {
|
|
69
80
|
|
|
81
|
+
loadEnv(cliOptions);
|
|
82
|
+
|
|
70
83
|
const supportRegister = checkRegisterFeature();
|
|
71
84
|
if (!supportRegister) {
|
|
72
85
|
return;
|
|
@@ -207,6 +220,8 @@ program
|
|
|
207
220
|
.option('--import <module>', 'preload module at startup')
|
|
208
221
|
.option('--require <module>', 'preload module at startup')
|
|
209
222
|
|
|
223
|
+
.option('--env [path]', 'env file (default: ".env")')
|
|
224
|
+
|
|
210
225
|
.action((_command, cliOptions) => {
|
|
211
226
|
const args = [].concat(program.args).concat(subArgv);
|
|
212
227
|
if (args[0] === '--') {
|
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
} = require('../utils/dedupe.js');
|
|
21
21
|
const { getSourceType, initSourceMapSourcesPath } = require('../utils/source-path.js');
|
|
22
22
|
|
|
23
|
-
const { decode } = require('
|
|
23
|
+
const { decode } = require('../packages/monocart-coverage-vendor.js');
|
|
24
24
|
|
|
25
25
|
const InfoBranch = require('./info-branch.js');
|
|
26
26
|
const InfoFunction = require('./info-function.js');
|