monocart-coverage-reports 2.5.2 → 2.5.4

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.
@@ -23,17 +23,20 @@ const filterPath = (str) => {
23
23
 
24
24
  const getSourcePath = (url, index = '', type = '') => {
25
25
 
26
+ // no url for anonymous
26
27
  if (!url) {
27
28
  // anonymous scripts will have __playwright_evaluation_script__ as their URL.
28
- url = pathToFileURL(['anonymous', index ? `-${index}` : '', type ? `.${type}` : ''].join('')).toString();
29
+ url = ['anonymous', index ? `-${index}` : '', type ? `.${type}` : ''].join('');
30
+ return filterPath(url);
29
31
  }
30
32
 
31
- // url could be a path
33
+ // already is file url
32
34
  if (url.startsWith('file:')) {
33
35
  const relPath = Util.relativePath(fileURLToPath(url));
34
36
  return filterPath(relPath);
35
37
  }
36
38
 
39
+ // http/https url, other url
37
40
  const urlObj = Util.resolveUrl(url);
38
41
  if (urlObj) {
39
42
  const host = [urlObj.hostname, urlObj.port].filter((it) => it).join('-');
@@ -49,8 +52,10 @@ const getSourcePath = (url, index = '', type = '') => {
49
52
  return filterPath(p);
50
53
  }
51
54
 
52
- url = pathToFileURL(url).toString();
53
- return filterPath(url);
55
+ // could be path
56
+ const fileUrl = pathToFileURL(url).toString();
57
+ const relPath = Util.relativePath(fileURLToPath(fileUrl));
58
+ return filterPath(relPath);
54
59
 
55
60
  };
56
61
 
package/lib/utils/util.js CHANGED
@@ -9,7 +9,13 @@ const CG = require('console-grid');
9
9
  const Share = require('../platform/share.js');
10
10
  const { deflateSync } = require('lz-utils');
11
11
 
12
- const { acornWalk } = require('../packages/monocart-coverage-vendor.js');
12
+ const { acornWalk, supportsColor } = require('../packages/monocart-coverage-vendor.js');
13
+
14
+ // https://github.com/chalk/supports-color
15
+ // disabled color if Terminal stdout does not support color
16
+ if (!supportsColor.stdout) {
17
+ EC.disabled = true;
18
+ }
13
19
 
14
20
  const Util = {
15
21
  ... Share,
package/lib/v8/v8.js CHANGED
@@ -63,7 +63,8 @@ const initV8ListAndSourcemap = async (v8list, options) => {
63
63
  // init id, sourcePath
64
64
  v8list = v8list.map((item, i) => {
65
65
 
66
- let source = item.source || item.text;
66
+ // it could be a empty file
67
+ let source = `${item.source || item.text || ''}`;
67
68
 
68
69
  // fix source with script offset
69
70
  let scriptOffset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "Monocart coverage reports",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -30,7 +30,8 @@
30
30
  "test-vm": "node ./test/test-vm.js",
31
31
  "test-istanbul": "node ./test/test-istanbul.js",
32
32
  "test-v8": "node ./test/test-v8.js",
33
- "test-browser": "node ./test/test.js && npm run test-istanbul && npm run test-v8 && npm run test-anonymous && npm run test-css",
33
+ "test-puppeteer": "node ./test/test-puppeteer.js",
34
+ "test-browser": "node ./test/test.js && npm run test-istanbul && npm run test-v8 && npm run test-puppeteer && npm run test-anonymous && npm run test-css",
34
35
  "test-anonymous": "node ./test/test-anonymous.js",
35
36
  "test-css": "node ./test/test-css.js",
36
37
  "test-cli": "npx mcr \"node ./test/test-node-env.js\" -o docs/cli -c test/cli-options.js",
@@ -55,10 +56,10 @@
55
56
  },
56
57
  "dependencies": {
57
58
  "console-grid": "~2.2.1",
58
- "eight-colors": "~1.2.1",
59
+ "eight-colors": "~1.3.0",
59
60
  "istanbul-lib-coverage": "~3.2.2",
60
61
  "istanbul-lib-report": "~3.0.1",
61
- "istanbul-reports": "~3.1.6",
62
+ "istanbul-reports": "~3.1.7",
62
63
  "lz-utils": "~2.0.2",
63
64
  "monocart-code-viewer": "~1.1.0",
64
65
  "monocart-formatter": "~2.3.1",
@@ -71,6 +72,7 @@
71
72
  "eslint-plugin-html": "^8.0.0",
72
73
  "eslint-plugin-vue": "^9.21.1",
73
74
  "stylelint": "^15.11.0",
74
- "stylelint-config-plus": "^1.0.4"
75
+ "stylelint-config-plus": "^1.0.4",
76
+ "supports-color": "^9.4.0"
75
77
  }
76
78
  }