monocart-coverage-reports 2.6.5 → 2.7.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.
@@ -2,16 +2,17 @@ const http = require('http');
2
2
  const https = require('https');
3
3
 
4
4
  // minimal http request for get sourcemap json
5
+ // https://nodejs.org/docs/latest/api/http.html#httprequesturl-options-callback
5
6
  const request = (options) => {
6
7
 
7
8
  const url = `${options.url}`;
9
+ const HTTP = url.startsWith('https') ? https : http;
8
10
  // console.log('request', url);
9
11
 
10
12
  return new Promise((resolve) => {
11
13
 
12
- const HTTP = url.startsWith('https') ? https : http;
13
-
14
- HTTP.get(url, (res) => {
14
+ // get method only
15
+ HTTP.get(url, options, (res) => {
15
16
  const { statusCode } = res;
16
17
 
17
18
  // Any 2xx status code signals a successful response but here we're only checking for 200.
@@ -19,7 +20,7 @@ const request = (options) => {
19
20
  // Consume response data to free up memory
20
21
  res.resume();
21
22
  const resErr = new Error(`Request Failed. Status Code: ${statusCode}`);
22
- resolve([resErr, null]);
23
+ resolve([resErr]);
23
24
  return;
24
25
  }
25
26
 
@@ -52,7 +53,7 @@ const request = (options) => {
52
53
 
53
54
  }).on('error', (httpErr) => {
54
55
 
55
- resolve([httpErr, null]);
56
+ resolve([httpErr]);
56
57
 
57
58
  });
58
59
 
@@ -248,6 +248,10 @@ const getSnapshot = (reportData) => {
248
248
  addPercent(snapshot.summary, summary);
249
249
 
250
250
  files.forEach((file) => {
251
+ // do NOT add debug file
252
+ if (file.debug) {
253
+ return;
254
+ }
251
255
  const fileSummary = {};
252
256
  addPercent(fileSummary, file.summary);
253
257
  fileSummary.uncoveredLines = getUncoveredLines(file);
package/lib/v8/v8.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const EC = require('eight-colors');
2
3
  const Util = require('../utils/util.js');
3
4
  const { getV8Summary } = require('./v8-summary.js');
4
5
  const { dedupeFlatRanges } = require('../utils/dedupe.js');
@@ -87,7 +88,7 @@ const initV8ListAndSourcemap = async (v8list, options) => {
87
88
  return true;
88
89
  }
89
90
  // 404 css, text will be empty
90
- // Util.logError(`Invalid source: ${entry.url}`);
91
+ Util.logDebug(EC.red(`Invalid source or coverage data: ${entry.url}`));
91
92
  // console.log(entry);
92
93
  });
93
94
 
package/package.json CHANGED
@@ -1,81 +1,83 @@
1
- {
2
- "name": "monocart-coverage-reports",
3
- "version": "2.6.5",
4
- "description": "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
- "./package.json": "./package.json"
17
- },
18
- "types": "./lib/index.d.ts",
19
- "scripts": {
20
- "build-docs": "node ./scripts/build-docs.js",
21
- "build-test": "node ./scripts/build-test.js",
22
- "build": "sf lint && sf b -p && npm run build-test",
23
- "test-node": "npm run test-node-env && npm run test-node-api && npm run test-node-ins && npm run test-node-cdp && npm run test-node-koa && npm run test-node-vm",
24
- "test-node-env": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-env node ./test/test-node-env.js && node ./test/generate-report.js",
25
- "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
26
- "test-node-fgc": "node ./test/test-node-fgc.js",
27
- "test-node-ins": "node ./test/test-node-ins.js",
28
- "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
29
- "test-node-koa": "node ./test/test-node-koa.js",
30
- "test-node-vm": "node ./test/test-node-vm.js",
31
- "test-istanbul": "node ./test/test-istanbul.js",
32
- "test-v8": "node ./test/test-v8.js",
33
- "test-puppeteer": "node ./test/test-puppeteer.js",
34
- "test-browser": "node ./test/test-browser.js && npm run test-istanbul && npm run test-v8 && npm run test-puppeteer && npm run test-anonymous && npm run test-css",
35
- "test-anonymous": "node ./test/test-anonymous.js",
36
- "test-css": "node ./test/test-css.js",
37
- "test-cli": "npx mcr node ./test/specs/node.test.js -c test/mcr.config.cli.js",
38
- "test-merge": "node ./test/test-merge.js",
39
- "test-merge-istanbul": "node ./test/test-merge-istanbul.js",
40
- "test-all": "npm run test-browser && npm run test-node && npm run test-cli && npm run test-merge && npm run build-docs",
41
- "test": "npx mcr npm run test-all -c test/mcr.config.mcr.js",
42
- "test:snap": "cross-env TEST_SNAPSHOT=true npm run test",
43
- "dev": "sf d v8",
44
- "open": "node ./scripts/open.js",
45
- "patch": "npm run build && npm run test && sf publish patch -r"
46
- },
47
- "workspaces": [
48
- "packages/*",
49
- "test"
50
- ],
51
- "files": [
52
- "lib"
53
- ],
54
- "license": "MIT",
55
- "repository": {
56
- "type": "git",
57
- "url": "git+https://github.com/cenfun/monocart-coverage-reports.git"
58
- },
59
- "dependencies": {
60
- "console-grid": "~2.2.2",
61
- "eight-colors": "~1.3.0",
62
- "istanbul-lib-coverage": "~3.2.2",
63
- "istanbul-lib-report": "~3.0.1",
64
- "istanbul-reports": "~3.1.7",
65
- "lz-utils": "~2.0.2",
66
- "monocart-code-viewer": "~1.1.2",
67
- "monocart-formatter": "~2.3.2",
68
- "turbogrid": "~3.0.13"
69
- },
70
- "devDependencies": {
71
- "commander": "^12.0.0",
72
- "eslint": "^8.57.0",
73
- "eslint-config-plus": "^1.0.6",
74
- "eslint-plugin-html": "^8.0.0",
75
- "eslint-plugin-vue": "^9.22.0",
76
- "minimatch": "^9.0.3",
77
- "stylelint": "^16.2.1",
78
- "stylelint-config-plus": "^1.1.0",
79
- "supports-color": "^9.4.0"
80
- }
81
- }
1
+ {
2
+ "name": "monocart-coverage-reports",
3
+ "version": "2.7.0",
4
+ "description": "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
+ "./package.json": "./package.json"
17
+ },
18
+ "types": "./lib/index.d.ts",
19
+ "scripts": {
20
+ "build-docs": "node ./scripts/build-docs.js",
21
+ "build-test": "node ./scripts/build-test.js",
22
+ "build": "sf lint && sf b -p && npm run build-test",
23
+ "test-node": "npm run test-node-env && npm run test-node-api && npm run test-node-ins && npm run test-node-cdp && npm run test-node-koa && npm run test-node-vm",
24
+ "test-node-env": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-env node ./test/test-node-env.js && node ./test/generate-report.js",
25
+ "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
26
+ "test-node-fgc": "node ./test/test-node-fgc.js",
27
+ "test-node-ins": "node ./test/test-node-ins.js",
28
+ "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
29
+ "test-node-koa": "node ./test/test-node-koa.js",
30
+ "test-node-vm": "node ./test/test-node-vm.js",
31
+ "test-istanbul": "node ./test/test-istanbul.js",
32
+ "test-v8": "node ./test/test-v8.js",
33
+ "test-puppeteer": "node ./test/test-puppeteer.js",
34
+ "test-browser": "node ./test/test-browser.js && npm run test-istanbul && npm run test-v8 && npm run test-puppeteer && npm run test-anonymous && npm run test-css",
35
+ "test-anonymous": "node ./test/test-anonymous.js",
36
+ "test-css": "node ./test/test-css.js",
37
+ "test-client": "node ./test/test-client.js",
38
+ "test-cli": "npx mcr node ./test/specs/node.test.js -c test/mcr.config.cli.js",
39
+ "test-merge": "node ./test/test-merge.js",
40
+ "test-merge-istanbul": "node ./test/test-merge-istanbul.js",
41
+ "test-all": "npm run test-browser && npm run test-node && npm run test-cli && npm run test-merge && npm run build-docs",
42
+ "test": "npx mcr npm run test-all -c test/mcr.config.mcr.js",
43
+ "test:snap": "cross-env TEST_SNAPSHOT=true npm run test",
44
+ "dev": "sf d v8",
45
+ "open": "node ./scripts/open.js",
46
+ "patch": "npm run build && npm run test && sf publish patch -r"
47
+ },
48
+ "workspaces": [
49
+ "packages/*",
50
+ "test"
51
+ ],
52
+ "files": [
53
+ "lib"
54
+ ],
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/cenfun/monocart-coverage-reports.git"
59
+ },
60
+ "dependencies": {
61
+ "console-grid": "~2.2.2",
62
+ "eight-colors": "~1.3.0",
63
+ "istanbul-lib-coverage": "~3.2.2",
64
+ "istanbul-lib-report": "~3.0.1",
65
+ "istanbul-reports": "~3.1.7",
66
+ "lz-utils": "~2.0.2",
67
+ "monocart-code-viewer": "~1.1.2",
68
+ "monocart-formatter": "~2.3.2",
69
+ "turbogrid": "~3.0.13"
70
+ },
71
+ "devDependencies": {
72
+ "commander": "^12.0.0",
73
+ "eslint": "^8.57.0",
74
+ "eslint-config-plus": "^1.0.6",
75
+ "eslint-plugin-html": "^8.0.0",
76
+ "eslint-plugin-vue": "^9.22.0",
77
+ "minimatch": "^9.0.3",
78
+ "stylelint": "^16.2.1",
79
+ "stylelint-config-plus": "^1.1.0",
80
+ "supports-color": "^9.4.0",
81
+ "ws": "^8.16.0"
82
+ }
83
+ }