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 CHANGED
@@ -1,10 +1,12 @@
1
1
  # Monocart Coverage Reports
2
2
 
3
- [![](https://img.shields.io/npm/v/monocart-coverage-reports)](https://www.npmjs.com/package/monocart-coverage-reports)
4
- [![](https://devimg.vercel.app/npm/downloads/monocart-coverage-reports?label={total}%20downloads/month)](https://www.npmjs.com/package/monocart-coverage-reports)
5
- ![](https://img.shields.io/librariesio/github/cenfun/monocart-coverage-reports)
6
- ![](https://img.shields.io/github/license/cenfun/monocart-coverage-reports)
7
- ![](https://img.shields.io/github/actions/workflow/status/cenfun/monocart-coverage-reports/ci.yml)
3
+ [![npm](https://img.shields.io/npm/v/monocart-coverage-reports)](https://www.npmjs.com/package/monocart-coverage-reports)
4
+ ![license](https://img.shields.io/github/license/cenfun/monocart-coverage-reports)
5
+ ![build](https://img.shields.io/github/actions/workflow/status/cenfun/monocart-coverage-reports/ci.yml)
6
+ [![install size](https://packagephobia.com/badge?p=monocart-coverage-reports)](https://packagephobia.com/result?p=monocart-coverage-reports)
7
+ [![npm graph](https://img.shields.io/badge/npm-graph-blue)](https://npmgraph.js.org/?q=monocart-coverage-reports)
8
+ ![dependencies](https://img.shields.io/librariesio/github/cenfun/monocart-coverage-reports)
9
+ [![downloads](https://devimg.vercel.app/npm/downloads/monocart-coverage-reports?label={total}%20downloads/month)](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
- - [tsx](#tsx)
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
- - [tsx](#tsx)
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
- - see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
1041
-
1042
- ### [tsx](https://github.com/privatenumber/tsx)
1058
+ - [ts-node](https://github.com/TypeStrong/ts-node)
1043
1059
  ```sh
1044
- mcr --import tsx tsx ./src/example.ts
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://img.shields.io/npm/v/monocart-coverage-reports)](https://www.npmjs.com/package/monocart-coverage-reports)
4
- [![](https://devimg.vercel.app/npm/downloads/monocart-coverage-reports?label={total}%20downloads/month)](https://www.npmjs.com/package/monocart-coverage-reports)
5
- ![](https://img.shields.io/librariesio/github/cenfun/monocart-coverage-reports)
6
- ![](https://img.shields.io/github/license/cenfun/monocart-coverage-reports)
7
- ![](https://img.shields.io/github/actions/workflow/status/cenfun/monocart-coverage-reports/ci.yml)
3
+ [![npm](https://img.shields.io/npm/v/monocart-coverage-reports)](https://www.npmjs.com/package/monocart-coverage-reports)
4
+ ![license](https://img.shields.io/github/license/cenfun/monocart-coverage-reports)
5
+ ![build](https://img.shields.io/github/actions/workflow/status/cenfun/monocart-coverage-reports/ci.yml)
6
+ [![install size](https://packagephobia.com/badge?p=monocart-coverage-reports)](https://packagephobia.com/result?p=monocart-coverage-reports)
7
+ [![npm graph](https://img.shields.io/badge/npm-graph-blue)](https://npmgraph.js.org/?q=monocart-coverage-reports)
8
+ ![dependencies](https://img.shields.io/librariesio/github/cenfun/monocart-coverage-reports)
9
+ [![downloads](https://devimg.vercel.app/npm/downloads/monocart-coverage-reports?label={total}%20downloads/month)](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
- - [tsx](#tsx)
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
- - [tsx](#tsx)
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
- - see [mcr-tsx](https://github.com/cenfun/mcr-tsx)
1045
-
1046
- ### [tsx](https://github.com/privatenumber/tsx)
1062
+ - [ts-node](https://github.com/TypeStrong/ts-node)
1047
1063
  ```sh
1048
- mcr --import tsx tsx ./src/example.ts
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('@jridgewell/sourcemap-codec');
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');
@@ -1,4 +1,4 @@
1
- const { decode } = require('@jridgewell/sourcemap-codec');
1
+ const { decode } = require('../packages/monocart-coverage-vendor.js');
2
2
 
3
3
  const COLUMN = 0;
4
4
  const SOURCES_INDEX = 1;