monocart-coverage-reports 2.5.4 → 2.5.6

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.
@@ -421,7 +421,7 @@ const Util = {
421
421
  const max = Math.pow(base, i + 1);
422
422
  if (v > min && v < max) {
423
423
  const unit = units[i];
424
- v = prefix + (v / min).toFixed(places) + space + unit;
424
+ v = prefix + parseFloat((v / min).toFixed(places)) + space + unit;
425
425
  break;
426
426
  }
427
427
  }
package/lib/utils/util.js CHANGED
@@ -501,10 +501,18 @@ const Util = {
501
501
 
502
502
  // time is debug level
503
503
  logTime: (message, time_start) => {
504
- if (Util.loggingLevel < Util.loggingLevels.debug) {
504
+ if (Util.loggingLevel < Util.loggingLevels.info) {
505
505
  return;
506
506
  }
507
+
508
+ const slowDuration = 1000;
507
509
  const duration = Date.now() - time_start;
510
+ if (Util.loggingLevel < Util.loggingLevels.debug) {
511
+ if (duration < slowDuration) {
512
+ return;
513
+ }
514
+ }
515
+
508
516
  const durationH = Util.TSF(duration);
509
517
  const ls = [`[MCR] ${message}`, ' ('];
510
518
  if (duration <= 100) {
package/lib/v8/v8.js CHANGED
@@ -5,8 +5,8 @@ const Util = require('../utils/util.js');
5
5
  const { getV8Summary } = require('./v8-summary.js');
6
6
  const { dedupeFlatRanges } = require('../utils/dedupe.js');
7
7
  const { getSourcePath } = require('../utils/source-path.js');
8
- const { mergeScriptCovs } = require('../packages/monocart-coverage-vendor.js');
9
- const collectSourceMaps = require('../converter/collect-source-maps.js');
8
+ const { mergeScriptCovs, minimatch } = require('../packages/monocart-coverage-vendor.js');
9
+ const { collectSourceMaps } = require('../converter/collect-source-maps.js');
10
10
  const version = require('../../package.json').version;
11
11
 
12
12
  const getWrapperSource = (offset, source) => {
@@ -23,18 +23,38 @@ const getWrapperSource = (offset, source) => {
23
23
  return startStr + source;
24
24
  };
25
25
 
26
- const initV8ListAndSourcemap = async (v8list, options) => {
27
-
28
- // filter list first
26
+ const getEntryFilter = (options) => {
29
27
  const entryFilter = options.entryFilter;
30
28
  if (typeof entryFilter === 'function') {
31
- v8list = v8list.filter(entryFilter);
29
+ return entryFilter;
32
30
  }
33
31
 
32
+ if (entryFilter && typeof entryFilter === 'string') {
33
+ return (entry) => {
34
+ return minimatch(entry.url, entryFilter);
35
+ };
36
+ }
37
+
38
+ return () => true;
39
+ };
40
+
41
+ const initV8ListAndSourcemap = async (v8list, options) => {
42
+
43
+ // entry filter
44
+ const entryFilter = getEntryFilter(options);
45
+
34
46
  // filter no source or text
35
47
  // init type and css source from text
36
48
  // keep functions
37
49
  v8list = v8list.filter((item) => {
50
+
51
+ // filter entry
52
+ if (!entryFilter(item)) {
53
+ // console.log('-', item.url);
54
+ return false;
55
+ }
56
+ // console.log(item.url);
57
+
38
58
  if (typeof item.source === 'string' && item.functions) {
39
59
  item.type = 'js';
40
60
  return true;
@@ -115,10 +135,11 @@ const initV8ListAndSourcemap = async (v8list, options) => {
115
135
 
116
136
  // collect sourcemap first
117
137
  const time_start = Date.now();
118
- const count = await collectSourceMaps(v8list, options);
119
- if (count) {
138
+ const smList = await collectSourceMaps(v8list, options);
139
+ if (smList.length) {
120
140
  // debug level time
121
- Util.logTime(`loaded sourcemaps: ${count}`, time_start);
141
+ Util.logTime(`loaded sourcemaps: ${smList.length}`, time_start);
142
+ // console.log(smList);
122
143
  }
123
144
 
124
145
  return v8list;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Monocart coverage reports",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -20,14 +20,14 @@
20
20
  "build-docs": "node ./scripts/build-docs.js",
21
21
  "build-test": "node ./scripts/build-test.js",
22
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-vm",
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
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
25
  "test-node-api": "cross-env NODE_V8_COVERAGE=.temp/v8-coverage-api node ./test/test-node-api.js",
26
26
  "test-node-fgc": "node ./test/test-node-fgc.js",
27
27
  "test-node-ins": "node ./test/test-node-ins.js",
28
28
  "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js",
29
29
  "test-node-koa": "node ./test/test-node-koa.js",
30
- "test-vm": "node ./test/test-vm.js",
30
+ "test-node-vm": "node ./test/test-node-vm.js",
31
31
  "test-istanbul": "node ./test/test-istanbul.js",
32
32
  "test-v8": "node ./test/test-v8.js",
33
33
  "test-puppeteer": "node ./test/test-puppeteer.js",
@@ -61,16 +61,17 @@
61
61
  "istanbul-lib-report": "~3.0.1",
62
62
  "istanbul-reports": "~3.1.7",
63
63
  "lz-utils": "~2.0.2",
64
- "monocart-code-viewer": "~1.1.0",
65
- "monocart-formatter": "~2.3.1",
64
+ "monocart-code-viewer": "~1.1.1",
65
+ "monocart-formatter": "~2.3.2",
66
66
  "turbogrid": "~3.0.13"
67
67
  },
68
68
  "devDependencies": {
69
69
  "commander": "^12.0.0",
70
- "eslint": "^8.56.0",
70
+ "eslint": "^8.57.0",
71
71
  "eslint-config-plus": "^1.0.6",
72
72
  "eslint-plugin-html": "^8.0.0",
73
- "eslint-plugin-vue": "^9.21.1",
73
+ "eslint-plugin-vue": "^9.22.0",
74
+ "minimatch": "^9.0.3",
74
75
  "stylelint": "^15.11.0",
75
76
  "stylelint-config-plus": "^1.0.4",
76
77
  "supports-color": "^9.4.0"