monocart-coverage-reports 2.10.9 → 2.11.0
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 +13 -12
- package/README.zh-Hans.md +13 -11
- 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/generate.js +52 -18
- package/lib/index.d.ts +2 -0
- 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/merge/merge.js +439 -0
- package/lib/utils/merge/range-tree.js +123 -0
- package/lib/utils/util.js +9 -0
- package/lib/v8/v8.js +13 -11
- package/package.json +118 -115
package/README.md
CHANGED
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
- [TestCafe](#testcafe)
|
|
54
54
|
- [Selenium Webdriver](#selenium-webdriver)
|
|
55
55
|
- [Mocha](#mocha)
|
|
56
|
-
- [
|
|
57
|
-
- [ts-node](#ts-node)
|
|
56
|
+
- [TypeScript](#typescript)
|
|
58
57
|
- [AVA](#ava)
|
|
59
58
|
- [Codecov](#codecov)
|
|
60
59
|
- [Codacy](#codacy)
|
|
@@ -776,8 +775,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js
|
|
|
776
775
|
|
|
777
776
|
- Examples
|
|
778
777
|
- [Mocha](#mocha)
|
|
779
|
-
- [
|
|
780
|
-
- [ts-node](#ts-node)
|
|
778
|
+
- [TypeScript](#typescript)
|
|
781
779
|
- [AVA](#ava)
|
|
782
780
|
|
|
783
781
|
## Config File
|
|
@@ -1034,19 +1032,22 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js
|
|
|
1034
1032
|
```sh
|
|
1035
1033
|
mcr mocha ./test/**/*.js
|
|
1036
1034
|
```
|
|
1035
|
+
|
|
1036
|
+
### [TypeScript](https://github.com/microsoft/typescript)
|
|
1037
|
+
|
|
1038
|
+
- [tsx](https://github.com/privatenumber/tsx)
|
|
1037
1039
|
```sh
|
|
1040
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts
|
|
1041
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts
|
|
1042
|
+
# Node.js v18.19.0 +
|
|
1043
|
+
mcr --import tsx tsx ./src/example.ts
|
|
1038
1044
|
mcr --import tsx mocha ./test/**/*.ts
|
|
1039
1045
|
```
|
|
1040
|
-
-
|
|
1041
|
-
|
|
1042
|
-
### [tsx](https://github.com/privatenumber/tsx)
|
|
1046
|
+
- [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1043
1047
|
```sh
|
|
1044
|
-
|
|
1048
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts
|
|
1049
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts
|
|
1045
1050
|
```
|
|
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
1051
|
|
|
1051
1052
|
### [AVA](https://github.com/avajs/ava)
|
|
1052
1053
|
```sh
|
package/README.zh-Hans.md
CHANGED
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
- [TestCafe](#testcafe)
|
|
54
54
|
- [Selenium Webdriver](#selenium-webdriver)
|
|
55
55
|
- [Mocha](#mocha)
|
|
56
|
-
- [
|
|
57
|
-
- [ts-node](#ts-node)
|
|
56
|
+
- [TypeScript](#typescript)
|
|
58
57
|
- [AVA](#ava)
|
|
59
58
|
- [Codecov](#codecov)
|
|
60
59
|
- [Codacy](#codacy)
|
|
@@ -779,8 +778,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js
|
|
|
779
778
|
|
|
780
779
|
- 参见例子
|
|
781
780
|
- [Mocha](#mocha)
|
|
782
|
-
- [
|
|
783
|
-
- [ts-node](#ts-node)
|
|
781
|
+
- [TypeScript](#typescript)
|
|
784
782
|
- [AVA](#ava)
|
|
785
783
|
|
|
786
784
|
## Config File
|
|
@@ -1038,19 +1036,23 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js
|
|
|
1038
1036
|
```sh
|
|
1039
1037
|
mcr mocha ./test/**/*.js
|
|
1040
1038
|
```
|
|
1039
|
+
|
|
1040
|
+
### [TypeScript](https://github.com/microsoft/typescript)
|
|
1041
|
+
|
|
1042
|
+
- [tsx](https://github.com/privatenumber/tsx)
|
|
1041
1043
|
```sh
|
|
1044
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts
|
|
1045
|
+
cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts
|
|
1046
|
+
# Node.js v18.19.0 +
|
|
1047
|
+
mcr --import tsx tsx ./src/example.ts
|
|
1042
1048
|
mcr --import tsx mocha ./test/**/*.ts
|
|
1043
1049
|
```
|
|
1044
|
-
-
|
|
1045
|
-
|
|
1046
|
-
### [tsx](https://github.com/privatenumber/tsx)
|
|
1050
|
+
- [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1047
1051
|
```sh
|
|
1048
|
-
|
|
1052
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts
|
|
1053
|
+
cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts
|
|
1049
1054
|
```
|
|
1050
|
-
- see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
|
|
1051
1055
|
|
|
1052
|
-
### [ts-node](https://github.com/TypeStrong/ts-node)
|
|
1053
|
-
- see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node)
|
|
1054
1056
|
|
|
1055
1057
|
### [AVA](https://github.com/avajs/ava)
|
|
1056
1058
|
```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');
|