monocart-coverage-reports 2.8.1 → 2.8.2

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
@@ -21,7 +21,7 @@
21
21
  - [Collecting V8 Coverage Data from Node.js](#collecting-v8-coverage-data-from-nodejs)
22
22
  - [Collecting V8 Coverage Data with `CDPClient` API](#collecting-v8-coverage-data-with-cdpclient-api)
23
23
  - [V8 Coverage Data API](#v8-coverage-data-api)
24
- * [Using `entryFilter` and `sourceFilter` to filter the results for V8 report](#using-entryfilter-and-sourcefilter-to-filter-the-results-for-v8-report)
24
+ * [Filtering Results](#filtering-results)
25
25
  * [Resolve `sourcePath` for the Source Files](#resolve-sourcepath-for-the-source-files)
26
26
  * [Adding Empty Coverage for Untested Files](#adding-empty-coverage-for-untested-files)
27
27
  * [onEnd Hook](#onend-hook)
@@ -53,6 +53,7 @@
53
53
  - [ts-node](#ts-node)
54
54
  - [AVA](#ava)
55
55
  - [Codecov](#codecov)
56
+ - [Codacy](#codacy)
56
57
  - [Coveralls](#coveralls)
57
58
  - [Sonar Cloud](#sonar-cloud)
58
59
  * [Contributing](#contributing)
@@ -467,7 +468,8 @@ export interface ScriptCoverage {
467
468
  export type V8CoverageData = ScriptCoverage[];
468
469
  ```
469
470
 
470
- ## Using `entryFilter` and `sourceFilter` to filter the results for V8 report
471
+ ## Filtering Results
472
+ ### Using `entryFilter` and `sourceFilter` to filter the results for V8 report
471
473
  When V8 coverage data collected, it actually contains the data of all entry files, for example:
472
474
 
473
475
  - *dist/main.js*
@@ -517,19 +519,33 @@ const coverageOptions = {
517
519
  }
518
520
  };
519
521
  ```
520
- In fact, the `minimatch` patterns will be transformed to a function like:
522
+ As CLI args (JSON-like string. Added in: v2.8):
523
+ ```sh
524
+ mcr --sourceFilter "{'**/node_modules/**':false,'**/**':true}"
525
+ ```
526
+ Note, those patterns will be transformed to a function, and the order of the patterns will impact the results:
521
527
  ```js
522
528
  const coverageOptions = {
523
- // '**/node_modules/**': false,
524
- // '**/vendor.js': false,
525
- // '**/src/**': true
526
529
  entryFilter: (entry) => {
527
530
  if (minimatch(entry.url, '**/node_modules/**')) { return false; }
528
531
  if (minimatch(entry.url, '**/vendor.js')) { return false; }
529
532
  if (minimatch(entry.url, '**/src/**')) { return true; }
530
533
  return false; // else unmatched
531
534
  }
532
- // Note, the order of the patterns will impact the results
535
+ };
536
+ ```
537
+
538
+ ### Using `filter` instead of `entryFilter` and `sourceFilter`
539
+ If you don't want to define both `entryFilter` and `sourceFilter`, you can use `filter` instead. (Added in: v2.8)
540
+ ```js
541
+ const coverageOptions = {
542
+ // combined patterns
543
+ filter: {
544
+ '**/node_modules/**': false,
545
+ '**/vendor.js': false,
546
+ '**/src/**': true
547
+ '**/**': true
548
+ }
533
549
  };
534
550
  ```
535
551
 
@@ -826,6 +842,7 @@ await new CoverageReport(coverageOptions).generate();
826
842
  }
827
843
  }
828
844
  ```
845
+ see example: [merge-code-coverage](https://github.com/cenfun/merge-code-coverage)
829
846
 
830
847
  ## Common issues
831
848
  ### Unexpected coverage
@@ -897,6 +914,7 @@ When `logging` is `debug`, the raw report data will be preserved in `[outputDir]
897
914
  - [playwright-coverage](https://github.com/cenfun/playwright-coverage) - Example for Playwright coverage reports
898
915
  - [playwright-bdd-coverage](https://github.com/cenfun/playwright-bdd-coverage) - Example for Playwright BDD coverage reports
899
916
  - [monocart-reporter](https://github.com/cenfun/monocart-reporter) - Playwright custom reporter, supports generating [Code coverage report](https://github.com/cenfun/monocart-reporter?#code-coverage-report)
917
+ - [merge-code-coverage](https://github.com/cenfun/merge-code-coverage) - Example for merging code coverage (unit + e2e shard)
900
918
  - Coverage for component testing with `monocart-reporter`:
901
919
  - [playwright-ct-vue](https://github.com/cenfun/playwright-ct-vue)
902
920
  - [playwright-ct-react](https://github.com/cenfun/playwright-ct-react)
@@ -969,13 +987,32 @@ const coverageOptions = {
969
987
  ]
970
988
  };
971
989
  ```
972
- - Github actions example:
990
+ - Github actions:
973
991
  ```yml
974
992
  - name: Codecov
975
993
  uses: codecov/codecov-action@v3
976
994
  with:
977
995
  files: ./coverage-reports/codecov.json
978
996
  ```
997
+
998
+ ### [Codacy](https://www.codacy.com/)
999
+ [![Codacy](https://app.codacy.com/project/badge/Coverage/715016ea8e90479db875b777db8bad55)](https://app.codacy.com/gh/cenfun/monocart-coverage-reports/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
1000
+ - Using `lcov` report:
1001
+ ```js
1002
+ const coverageOptions = {
1003
+ outputDir: "./coverage-reports",
1004
+ lcov: true
1005
+ };
1006
+ ```
1007
+ - Github actions:
1008
+ ```yml
1009
+ - name: Codacy Coverage Reporter
1010
+ uses: codacy/codacy-coverage-reporter-action@v1
1011
+ with:
1012
+ project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
1013
+ coverage-reports: ./docs/mcr/lcov.info
1014
+ ```
1015
+
979
1016
  ### [Coveralls](https://coveralls.io/)
980
1017
  [![Coverage Status](https://coveralls.io/repos/github/cenfun/monocart-coverage-reports/badge.svg?branch=main)](https://coveralls.io/github/cenfun/monocart-coverage-reports?branch=main)
981
1018
  - Using `lcov` report:
@@ -985,13 +1022,14 @@ const coverageOptions = {
985
1022
  lcov: true
986
1023
  };
987
1024
  ```
988
- - Github actions example:
1025
+ - Github actions:
989
1026
  ```yml
990
1027
  - name: Coveralls
991
1028
  uses: coverallsapp/github-action@v2
992
1029
  with:
993
1030
  files: ./coverage-reports/lcov.info
994
1031
  ```
1032
+
995
1033
  ### [Sonar Cloud](https://sonarcloud.io/)
996
1034
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=monocart-coverage-reports&metric=coverage)](https://sonarcloud.io/summary/new_code?id=monocart-coverage-reports)
997
1035
  - Using `lcov` report. Github actions example:
@@ -1013,8 +1051,9 @@ const coverageOptions = {
1013
1051
  ```
1014
1052
 
1015
1053
  ## Contributing
1054
+ - Node.js 20+
1055
+ - VSCode (extensions: eslint/stylelint/vue)
1016
1056
  ```sh
1017
- # Node.js 20+
1018
1057
  npm install starfall-cli -g
1019
1058
  npm install
1020
1059
 
package/README.zh-Hans.md CHANGED
@@ -21,7 +21,7 @@
21
21
  - [从Node.js](#collecting-v8-coverage-data-from-nodejs)
22
22
  - [使用`CDPClient`API](#collecting-v8-coverage-data-with-cdpclient-api)
23
23
  - [参考V8覆盖率的API](#v8-coverage-data-api)
24
- * [使用 `entryFilter` 和 `sourceFilter` 来过滤V8覆盖率数据](#using-entryfilter-and-sourcefilter-to-filter-the-results-for-v8-report)
24
+ * [过滤V8覆盖率数据](#filtering-results)
25
25
  * [使用 `sourcePath` 修改源文件路径](#resolve-sourcepath-for-the-source-files)
26
26
  * [为未测试的文件添加空的覆盖率报告](#adding-empty-coverage-for-untested-files)
27
27
  * [onEnd回调函数](#onend-hook)
@@ -53,6 +53,7 @@
53
53
  - [ts-node](#ts-node)
54
54
  - [AVA](#ava)
55
55
  - [Codecov](#codecov)
56
+ - [Codacy](#codacy)
56
57
  - [Coveralls](#coveralls)
57
58
  - [Sonar Cloud](#sonar-cloud)
58
59
  * [Contributing](#contributing)
@@ -471,6 +472,7 @@ export interface ScriptCoverage {
471
472
  export type V8CoverageData = ScriptCoverage[];
472
473
  ```
473
474
 
475
+ ## Filtering Results
474
476
  ## Using `entryFilter` and `sourceFilter` to filter the results for V8 report
475
477
  当收集到V8的覆盖数据时,它实际上包含了所有的入口文件的覆盖率数据, 比如有以下3个文件:
476
478
 
@@ -521,19 +523,33 @@ const coverageOptions = {
521
523
  }
522
524
  };
523
525
  ```
524
- 这些`minimatch`匹配的运行逻辑,大概相当于:
526
+ 作为CLI参数(JSON字符串,Added in: v2.8):
527
+ ```sh
528
+ mcr --sourceFilter "{'**/node_modules/**':false,'**/**':true}"
529
+ ```
530
+ 注意,这些匹配实际上会转换成一个过滤函数(如下),所以如果一个匹配成功则会直接返回,后面的将不再继续匹配。请注意先后顺序,如果存在包含关系的,可以调整上下顺序,最后如果都未匹配,则默认返回false
525
531
  ```js
526
532
  const coverageOptions = {
527
- // '**/node_modules/**': false,
528
- // '**/vendor.js': false,
529
- // '**/src/**': true
530
533
  entryFilter: (entry) => {
531
534
  if (minimatch(entry.url, '**/node_modules/**')) { return false; }
532
535
  if (minimatch(entry.url, '**/vendor.js')) { return false; }
533
536
  if (minimatch(entry.url, '**/src/**')) { return true; }
534
537
  return false; // else unmatched
535
538
  }
536
- // 注意,前面的如果已经匹配到会直接返回,后面的不会继续匹配,所以如果存在包含关系的,需要注意每个匹配的上下顺序,最后如果都未匹配,则默认返回false
539
+ };
540
+ ```
541
+
542
+ ### Using `filter` instead of `entryFilter` and `sourceFilter`
543
+ 如果你不想定义两个过滤器,可以使用 `filter` 选项代替,可以将多个匹配合并在一起. (Added in: v2.8)
544
+ ```js
545
+ const coverageOptions = {
546
+ // combined patterns
547
+ filter: {
548
+ '**/node_modules/**': false,
549
+ '**/vendor.js': false,
550
+ '**/src/**': true
551
+ '**/**': true
552
+ }
537
553
  };
538
554
  ```
539
555
 
@@ -828,6 +844,7 @@ await new CoverageReport(coverageOptions).generate();
828
844
  }
829
845
  }
830
846
  ```
847
+ 参见例子: [merge-code-coverage](https://github.com/cenfun/merge-code-coverage)
831
848
 
832
849
  ## Common issues
833
850
  > 常见问题
@@ -901,6 +918,7 @@ const coverageOptions = {
901
918
  - [playwright-coverage](https://github.com/cenfun/playwright-coverage) - Example for Playwright coverage reports
902
919
  - [playwright-bdd-coverage](https://github.com/cenfun/playwright-bdd-coverage) - Example for Playwright BDD coverage reports
903
920
  - [monocart-reporter](https://github.com/cenfun/monocart-reporter) - Playwright custom reporter, supports generating [Code coverage report](https://github.com/cenfun/monocart-reporter?#code-coverage-report)
921
+ - [merge-code-coverage](https://github.com/cenfun/merge-code-coverage) - Example for merging code coverage (unit + e2e shard)
904
922
  - Coverage for component testing with `monocart-reporter`:
905
923
  - [playwright-ct-vue](https://github.com/cenfun/playwright-ct-vue)
906
924
  - [playwright-ct-react](https://github.com/cenfun/playwright-ct-react)
@@ -980,6 +998,25 @@ const coverageOptions = {
980
998
  with:
981
999
  files: ./coverage-reports/codecov.json
982
1000
  ```
1001
+
1002
+ ### [Codacy](https://www.codacy.com/)
1003
+ [![Codacy](https://app.codacy.com/project/badge/Coverage/715016ea8e90479db875b777db8bad55)](https://app.codacy.com/gh/cenfun/monocart-coverage-reports/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
1004
+ - Using `lcov` report:
1005
+ ```js
1006
+ const coverageOptions = {
1007
+ outputDir: "./coverage-reports",
1008
+ lcov: true
1009
+ };
1010
+ ```
1011
+ - Github actions:
1012
+ ```yml
1013
+ - name: Codacy Coverage Reporter
1014
+ uses: codacy/codacy-coverage-reporter-action@v1
1015
+ with:
1016
+ project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
1017
+ coverage-reports: ./docs/mcr/lcov.info
1018
+ ```
1019
+
983
1020
  ### [Coveralls](https://coveralls.io/)
984
1021
  [![Coverage Status](https://coveralls.io/repos/github/cenfun/monocart-coverage-reports/badge.svg?branch=main)](https://coveralls.io/github/cenfun/monocart-coverage-reports?branch=main)
985
1022
  - Using `lcov` report:
@@ -996,6 +1033,7 @@ const coverageOptions = {
996
1033
  with:
997
1034
  files: ./coverage-reports/lcov.info
998
1035
  ```
1036
+
999
1037
  ### [Sonar Cloud](https://sonarcloud.io/)
1000
1038
  [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=monocart-coverage-reports&metric=coverage)](https://sonarcloud.io/summary/new_code?id=monocart-coverage-reports)
1001
1039
  - Using `lcov` report. Github actions example:
@@ -1017,8 +1055,9 @@ const coverageOptions = {
1017
1055
  ```
1018
1056
 
1019
1057
  ## Contributing
1058
+ - Node.js 20+
1059
+ - VSCode (extensions: eslint/stylelint/vue)
1020
1060
  ```sh
1021
- # Node.js 20+
1022
1061
  npm install starfall-cli -g
1023
1062
  npm install
1024
1063
 
@@ -2,7 +2,40 @@ const path = require('path');
2
2
  const { fileURLToPath, pathToFileURL } = require('url');
3
3
  const Util = require('./util.js');
4
4
 
5
+ const resolveSourceRootUrl = (sourceName, sourceRoot) => {
6
+ // prepend sourceRoot
7
+ if (sourceRoot && !sourceName.startsWith(sourceRoot)) {
8
+ if (!sourceRoot.endsWith('/')) {
9
+ sourceRoot += '/';
10
+ }
11
+ return sourceRoot + sourceName;
12
+ }
13
+ return sourceName;
14
+ };
15
+
16
+ const resolveAnonymousUrl = (url, index, type) => {
17
+ if (url) {
18
+ return url;
19
+ }
20
+ // anonymous scripts will have __playwright_evaluation_script__ as their URL.
21
+ const list = ['anonymous'];
22
+ if (index) {
23
+ list.push(`-${index}`);
24
+ }
25
+ if (type) {
26
+ list.push(`.${type}`);
27
+ }
28
+ return list.join('');
29
+ };
30
+
5
31
  const filterPath = (str) => {
32
+ // double \\ to /
33
+
34
+ // src/images/icons/ sync \.svg$
35
+ // src/images/icons/sync-.svg$
36
+
37
+ str = str.replace(/\\\\/g, '/');
38
+ // decodeURI("%20") to space
6
39
  str = decodeURI(str);
7
40
  // remove / of start, end or double, ./ ../
8
41
  const ls = str.split('/').map((it) => {
@@ -21,24 +54,42 @@ const filterPath = (str) => {
21
54
  return ls.join('/');
22
55
  };
23
56
 
24
- // eslint-disable-next-line complexity
25
- const normalizeSourcePath = (url, baseDir, index = '', type = '') => {
57
+ const normalizeSourcePath = (sourceUrl, baseDir) => {
58
+
59
+ // includes anonymous and everything
26
60
 
27
- // no url for anonymous
28
- if (!url) {
29
- // anonymous scripts will have __playwright_evaluation_script__ as their URL.
30
- url = ['anonymous', index ? `-${index}` : '', type ? `.${type}` : ''].join('');
31
- return filterPath(url);
61
+ // file url
62
+ if (sourceUrl.startsWith('file:')) {
63
+ const relPath = Util.relativePath(fileURLToPath(sourceUrl), baseDir);
64
+ return filterPath(relPath);
32
65
  }
33
66
 
34
- // already is file url
35
- if (url.startsWith('file:')) {
36
- const relPath = Util.relativePath(fileURLToPath(url), baseDir);
67
+ // absolute path
68
+ // c:\\workspace\test\\selenium.spec.js true
69
+ // c://a.js true
70
+ // c:\\a.js true
71
+ // C:/a.js true
72
+ // /a.js true
73
+
74
+ // a.js false
75
+ // ws://a.js false
76
+ // file://a.js false
77
+ // http://a.com/a.js false
78
+ // webpack://src/a.js false
79
+
80
+ if (path.isAbsolute(sourceUrl)) {
81
+ const relPath = Util.relativePath(sourceUrl, baseDir);
37
82
  return filterPath(relPath);
38
83
  }
39
84
 
40
- // http/https url, other url
41
- const urlObj = Util.resolveUrl(url);
85
+ // ws://a.js
86
+ // http://127.0.0:8080/a.js
87
+ // https://127.0.0:8080/a.js?v=1
88
+ // webpack://coverage-v8/./test/mock/src/branch/branch.js
89
+ // webpack://monocart-v8/../starfall-cli/node_modules/css-loader/dist/runtime/api.js
90
+
91
+ // url http/https/webpack
92
+ const urlObj = Util.resolveUrl(sourceUrl);
42
93
  if (urlObj) {
43
94
  const host = [urlObj.hostname, urlObj.port].filter((it) => it).join('-');
44
95
  // always start with '/'
@@ -53,11 +104,10 @@ const normalizeSourcePath = (url, baseDir, index = '', type = '') => {
53
104
  return filterPath(p);
54
105
  }
55
106
 
56
- // could be path
57
- const fileUrl = pathToFileURL(url).toString();
107
+ // relative path
108
+ const fileUrl = pathToFileURL(sourceUrl).toString();
58
109
  const relPath = Util.relativePath(fileURLToPath(fileUrl), baseDir);
59
110
  return filterPath(relPath);
60
-
61
111
  };
62
112
 
63
113
  const getSourceType = (sourcePath) => {
@@ -144,45 +194,6 @@ const initIstanbulSourcePath = (coverageData, fileSources, options) => {
144
194
 
145
195
  // ========================================================================================================
146
196
 
147
- const resolveSourceUrl = (sourceName, sourceRoot) => {
148
-
149
- // prepend sourceRoot
150
- if (sourceRoot && !sourceName.startsWith(sourceRoot)) {
151
- if (!sourceRoot.endsWith('/')) {
152
- sourceRoot += '/';
153
- }
154
- sourceName = sourceRoot + sourceName;
155
- }
156
-
157
- // could be absolute path
158
- // c:\\workspace\test\\selenium.spec.js
159
- // a.js false
160
- // c://a.js true
161
- // ws://a.js false
162
-
163
- if (path.isAbsolute(sourceName)) {
164
- return pathToFileURL(sourceName).toString();
165
- }
166
-
167
- // webpack://coverage-v8/./test/mock/src/branch/branch.js
168
- // webpack://monocart-v8/../starfall-cli/node_modules/css-loader/dist/runtime/api.js
169
-
170
- // as url
171
- const urlObj = Util.resolveUrl(sourceName);
172
- if (urlObj) {
173
- return urlObj.toString();
174
- }
175
-
176
- // console.log('sourceName', sourceName);
177
-
178
- // as relative path
179
- const sourceUrl = pathToFileURL(sourceName).toString();
180
-
181
- // console.log('sourceUrl', sourceUrl);
182
-
183
- return sourceUrl;
184
- };
185
-
186
197
  const initSourceMapSourcesPath = (fileUrls, sourceMap, distFile, options) => {
187
198
 
188
199
  const baseDir = options.baseDir;
@@ -190,9 +201,9 @@ const initSourceMapSourcesPath = (fileUrls, sourceMap, distFile, options) => {
190
201
 
191
202
  sourceMap.sources = sourceMap.sources.map((sourceName, i) => {
192
203
 
193
- const sourceUrl = resolveSourceUrl(sourceName, sourceMap.sourceRoot);
194
-
195
- let sourcePath = normalizeSourcePath(sourceUrl, baseDir, i + 1);
204
+ let sourceUrl = resolveSourceRootUrl(sourceName, sourceMap.sourceRoot);
205
+ sourceUrl = resolveAnonymousUrl(sourceUrl, i + 1, 'js');
206
+ let sourcePath = normalizeSourcePath(sourceUrl, baseDir);
196
207
  // console.log(sourceUrl, sourcePath);
197
208
 
198
209
  if (sourcePathReplacer) {
@@ -213,9 +224,7 @@ const initSourceMapSourcesPath = (fileUrls, sourceMap, distFile, options) => {
213
224
  };
214
225
 
215
226
  module.exports = {
216
- // for unit test
217
- resolveSourceUrl,
218
-
227
+ resolveAnonymousUrl,
219
228
  normalizeSourcePath,
220
229
  getSourceType,
221
230
  getSourcePathReplacer,
package/lib/v8/v8.js CHANGED
@@ -3,7 +3,9 @@ const EC = require('eight-colors');
3
3
  const Util = require('../utils/util.js');
4
4
  const { getV8Summary } = require('./v8-summary.js');
5
5
  const { dedupeFlatRanges } = require('../utils/dedupe.js');
6
- const { normalizeSourcePath, getSourcePathReplacer } = require('../utils/source-path.js');
6
+ const {
7
+ resolveAnonymousUrl, normalizeSourcePath, getSourcePathReplacer
8
+ } = require('../utils/source-path.js');
7
9
  const { mergeScriptCovs, minimatch } = require('../packages/monocart-coverage-vendor.js');
8
10
  const { collectSourceMaps } = require('../converter/collect-source-maps.js');
9
11
  const version = require('../../package.json').version;
@@ -151,7 +153,8 @@ const initV8ListAndSourcemap = async (v8list, options) => {
151
153
  }
152
154
 
153
155
  // resolve source path
154
- let sourcePath = normalizeSourcePath(data.url, baseDir, i + 1, data.type);
156
+ const sourceUrl = resolveAnonymousUrl(data.url, i + 1, data.type);
157
+ let sourcePath = normalizeSourcePath(sourceUrl, baseDir);
155
158
  if (sourcePathReplacer) {
156
159
  const newSourcePath = sourcePathReplacer(sourcePath, data);
157
160
  if (typeof newSourcePath === 'string' && newSourcePath) {
@@ -159,6 +162,7 @@ const initV8ListAndSourcemap = async (v8list, options) => {
159
162
  }
160
163
  }
161
164
  data.sourcePath = sourcePath;
165
+ // console.log(data.url, sourcePath);
162
166
 
163
167
  // calculate source id
164
168
  data.id = Util.calculateSha1(sourcePath + data.source);
package/package.json CHANGED
@@ -1,101 +1,101 @@
1
- {
2
- "name": "monocart-coverage-reports",
3
- "version": "2.8.1",
4
- "description": "A code coverage tool to generate native V8 reports or Istanbul reports.",
5
- "main": "./lib/index.js",
6
- "bin": {
7
- "mcr": "./lib/cli.js"
8
- },
9
- "exports": {
10
- ".": {
11
- "types": "./lib/index.d.ts",
12
- "import": "./lib/index.mjs",
13
- "require": "./lib/index.js",
14
- "default": "./lib/index.js"
15
- },
16
- "./register": {
17
- "import": "./lib/register/register.mjs",
18
- "require": "./lib/register/register.js",
19
- "default": "./lib/register/register.js"
20
- },
21
- "./converter": "./lib/converter/converter.js",
22
- "./util": "./lib/utils/util.js",
23
- "./package.json": "./package.json"
24
- },
25
- "types": "./lib/index.d.ts",
26
- "scripts": {
27
- "build-test": "node ./test/build/build-test.js",
28
- "build": "sf lint && sf b -p && npm run build-test",
29
- "test-unit": "mocha --parallel test/unit/*.test.js",
30
- "test-node-env": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-env node ./test/test-node-env.js && node ./test/generate-report.js",
31
- "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
32
- "test-node-ins": "node ./test/test-node-ins.js",
33
- "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
34
- "test-node-vm": "node ./test/test-node-vm.js",
35
- "test-node-koa": "node ./test/test-node-koa.js",
36
- "test-node-fgc": "node ./test/test-node-fgc.js",
37
- "test-node": "node ./test/test.js --node",
38
- "test-istanbul": "node ./test/test-istanbul.js",
39
- "test-v8": "node ./test/test-v8.js",
40
- "test-puppeteer": "node ./test/test-puppeteer.js",
41
- "test-anonymous": "node ./test/test-anonymous.js",
42
- "test-css": "node ./test/test-css.js",
43
- "test-minify": "node ./test/test-minify.js",
44
- "test-esbuild": "node ./test/test-esbuild.js",
45
- "test-rollup": "node ./test/test-rollup.js",
46
- "test-swc": "node ./test/test-swc.js",
47
- "test-v8-and-istanbul": "node ./test/test-v8-and-istanbul.js",
48
- "test-browser": "node ./test/test.js --browser",
49
- "test-cli": "npx mcr node ./test/specs/node.test.js -c test/mcr.config.cli.js",
50
- "test-tsx": "npx mcr tsx ./test/specs/tsx.test.ts -c test/mcr.config.tsx.js",
51
- "test-demo": "node ./test/test-demo.js",
52
- "test-merge": "node ./test/test-merge.js",
53
- "test-merge-istanbul": "node ./test/test-merge-istanbul.js",
54
- "test-client": "node ./test/test-client.js",
55
- "test-all": "node ./test/test.js && node ./scripts/docs.js",
56
- "test": "npm run test-unit && npx mcr npm run test-all -c test/mcr.config.mcr.js",
57
- "test:snap": "cross-env TEST_SNAPSHOT=true npm run test",
58
- "dev": "sf d v8",
59
- "open": "node ./scripts/open.js",
60
- "patch": "npm run build && npm run test && sf publish patch -r"
61
- },
62
- "workspaces": [
63
- "packages/*",
64
- "test"
65
- ],
66
- "files": [
67
- "lib",
68
- "README.zh-Hans.md"
69
- ],
70
- "license": "MIT",
71
- "repository": {
72
- "type": "git",
73
- "url": "git+https://github.com/cenfun/monocart-coverage-reports.git"
74
- },
75
- "dependencies": {
76
- "console-grid": "^2.2.2",
77
- "eight-colors": "^1.3.0",
78
- "istanbul-lib-coverage": "^3.2.2",
79
- "istanbul-lib-report": "^3.0.1",
80
- "istanbul-reports": "^3.1.7",
81
- "lz-utils": "^2.0.2",
82
- "monocart-code-viewer": "^1.1.3",
83
- "monocart-formatter": "^3.0.0",
84
- "monocart-locator": "^1.0.0",
85
- "turbogrid": "^3.0.13"
86
- },
87
- "devDependencies": {
88
- "commander": "^12.0.0",
89
- "esbuild": "^0.21.1",
90
- "eslint": "~9.2.0",
91
- "eslint-config-plus": "^2.0.0",
92
- "eslint-plugin-html": "^8.1.1",
93
- "eslint-plugin-vue": "^9.26.0",
94
- "minimatch": "^9.0.4",
95
- "stylelint": "^16.5.0",
96
- "stylelint-config-plus": "^1.1.2",
97
- "supports-color": "^9.4.0",
98
- "tsx": "^4.9.3",
99
- "ws": "^8.17.0"
100
- }
101
- }
1
+ {
2
+ "name": "monocart-coverage-reports",
3
+ "version": "2.8.2",
4
+ "description": "A code coverage tool to generate native V8 reports or Istanbul reports.",
5
+ "main": "./lib/index.js",
6
+ "bin": {
7
+ "mcr": "./lib/cli.js"
8
+ },
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "import": "./lib/index.mjs",
13
+ "require": "./lib/index.js",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./register": {
17
+ "import": "./lib/register/register.mjs",
18
+ "require": "./lib/register/register.js",
19
+ "default": "./lib/register/register.js"
20
+ },
21
+ "./converter": "./lib/converter/converter.js",
22
+ "./util": "./lib/utils/util.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "types": "./lib/index.d.ts",
26
+ "scripts": {
27
+ "build-test": "node ./test/build/build-test.js",
28
+ "build": "sf lint && sf b -p && npm run build-test",
29
+ "test-unit": "mocha --parallel test/unit/*.test.js",
30
+ "test-node-env": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-env node ./test/test-node-env.js && node ./test/generate-report.js",
31
+ "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
32
+ "test-node-ins": "node ./test/test-node-ins.js",
33
+ "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
34
+ "test-node-vm": "node ./test/test-node-vm.js",
35
+ "test-node-koa": "node ./test/test-node-koa.js",
36
+ "test-node-fgc": "node ./test/test-node-fgc.js",
37
+ "test-node": "node ./test/test.js --node",
38
+ "test-istanbul": "node ./test/test-istanbul.js",
39
+ "test-v8": "node ./test/test-v8.js",
40
+ "test-puppeteer": "node ./test/test-puppeteer.js",
41
+ "test-anonymous": "node ./test/test-anonymous.js",
42
+ "test-css": "node ./test/test-css.js",
43
+ "test-minify": "node ./test/test-minify.js",
44
+ "test-esbuild": "node ./test/test-esbuild.js",
45
+ "test-rollup": "node ./test/test-rollup.js",
46
+ "test-swc": "node ./test/test-swc.js",
47
+ "test-v8-and-istanbul": "node ./test/test-v8-and-istanbul.js",
48
+ "test-browser": "node ./test/test.js --browser",
49
+ "test-cli": "npx mcr node ./test/specs/node.test.js -c test/mcr.config.cli.js",
50
+ "test-tsx": "npx mcr tsx ./test/specs/tsx.test.ts -c test/mcr.config.tsx.js",
51
+ "test-demo": "node ./test/test-demo.js",
52
+ "test-merge": "node ./test/test-merge.js",
53
+ "test-merge-istanbul": "node ./test/test-merge-istanbul.js",
54
+ "test-client": "node ./test/test-client.js",
55
+ "test-all": "node ./test/test.js && node ./scripts/docs.js",
56
+ "test": "npm run test-unit && npx mcr npm run test-all -c test/mcr.config.mcr.js",
57
+ "test:snap": "cross-env TEST_SNAPSHOT=true npm run test",
58
+ "dev": "sf d v8",
59
+ "open": "node ./scripts/open.js",
60
+ "patch": "npm run build && npm run test && sf publish patch -r"
61
+ },
62
+ "workspaces": [
63
+ "packages/*",
64
+ "test"
65
+ ],
66
+ "files": [
67
+ "lib",
68
+ "README.zh-Hans.md"
69
+ ],
70
+ "license": "MIT",
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git+https://github.com/cenfun/monocart-coverage-reports.git"
74
+ },
75
+ "dependencies": {
76
+ "console-grid": "^2.2.2",
77
+ "eight-colors": "^1.3.0",
78
+ "istanbul-lib-coverage": "^3.2.2",
79
+ "istanbul-lib-report": "^3.0.1",
80
+ "istanbul-reports": "^3.1.7",
81
+ "lz-utils": "^2.0.2",
82
+ "monocart-code-viewer": "^1.1.3",
83
+ "monocart-formatter": "^3.0.0",
84
+ "monocart-locator": "^1.0.0",
85
+ "turbogrid": "^3.0.13"
86
+ },
87
+ "devDependencies": {
88
+ "commander": "^12.0.0",
89
+ "esbuild": "^0.21.3",
90
+ "eslint": "~9.2.0",
91
+ "eslint-config-plus": "^2.0.0",
92
+ "eslint-plugin-html": "^8.1.1",
93
+ "eslint-plugin-vue": "^9.26.0",
94
+ "minimatch": "^9.0.4",
95
+ "stylelint": "^16.5.0",
96
+ "stylelint-config-plus": "^1.1.2",
97
+ "supports-color": "^9.4.0",
98
+ "tsx": "^4.10.3",
99
+ "ws": "^8.17.0"
100
+ }
101
+ }