monocart-coverage-reports 2.11.2 → 2.11.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.
@@ -1,6 +1,5 @@
1
1
  const CG = require('console-grid');
2
2
  const EC = require('eight-colors');
3
- const { minimatch } = require('../packages/monocart-coverage-vendor.js');
4
3
  const { getGroupedRows } = require('../utils/snapshot.js');
5
4
  const Util = require('../utils/util.js');
6
5
 
@@ -78,7 +77,7 @@ const getFileFilter = (input) => {
78
77
  input = obj;
79
78
  } else {
80
79
  return (file) => {
81
- return minimatch(file.sourcePath, input);
80
+ return Util.betterMinimatch(file.sourcePath, input);
82
81
  };
83
82
  }
84
83
  }
@@ -89,7 +88,7 @@ const getFileFilter = (input) => {
89
88
  return (file) => {
90
89
  const sourcePath = file.sourcePath;
91
90
  for (const pattern of patterns) {
92
- if (minimatch(sourcePath, pattern)) {
91
+ if (Util.betterMinimatch(sourcePath, pattern)) {
93
92
  return input[pattern];
94
93
  }
95
94
  }
@@ -56,13 +56,23 @@ const filterPath = (str) => {
56
56
  return ls.join('/');
57
57
  };
58
58
 
59
+ const betterFileURLToPath = (url) => {
60
+ try {
61
+ url = fileURLToPath(url);
62
+ } catch (e) {
63
+ url = decodeURIComponent(url);
64
+ url = fileURLToPath(url);
65
+ }
66
+ return url;
67
+ };
68
+
59
69
  const normalizeSourcePath = (sourceUrl, baseDir) => {
60
70
 
61
71
  // includes anonymous and everything
62
72
 
63
73
  // file url
64
74
  if (sourceUrl.startsWith('file:')) {
65
- const relPath = Util.relativePath(fileURLToPath(sourceUrl), baseDir);
75
+ const relPath = Util.relativePath(betterFileURLToPath(sourceUrl), baseDir);
66
76
  return filterPath(relPath);
67
77
  }
68
78
 
@@ -108,7 +118,7 @@ const normalizeSourcePath = (sourceUrl, baseDir) => {
108
118
 
109
119
  // relative path
110
120
  const fileUrl = pathToFileURL(sourceUrl).toString();
111
- const relPath = Util.relativePath(fileURLToPath(fileUrl), baseDir);
121
+ const relPath = Util.relativePath(betterFileURLToPath(fileUrl), baseDir);
112
122
  return filterPath(relPath);
113
123
  };
114
124
 
package/lib/utils/util.js CHANGED
@@ -171,6 +171,38 @@ const Util = {
171
171
  };
172
172
  },
173
173
 
174
+ betterMinimatch: (str, pattern) => {
175
+ str = `${str}`;
176
+ pattern = `${pattern}`;
177
+
178
+ if (pattern === '*') {
179
+ return true;
180
+ }
181
+
182
+ // includes first
183
+ if (str.includes(pattern)) {
184
+ return true;
185
+ }
186
+
187
+ // with minimatch
188
+ if (minimatch(str, pattern)) {
189
+ return true;
190
+ }
191
+
192
+ // after decode url
193
+ str = decodeURIComponent(str);
194
+
195
+ if (str.includes(pattern)) {
196
+ return true;
197
+ }
198
+
199
+ if (minimatch(str, pattern)) {
200
+ return true;
201
+ }
202
+
203
+ return false;
204
+ },
205
+
174
206
  // eslint-disable-next-line complexity
175
207
  getEntryFilter: (options) => {
176
208
  // for entry.url
@@ -197,7 +229,7 @@ const Util = {
197
229
  input = obj;
198
230
  } else {
199
231
  const handler = (entry) => {
200
- return minimatch(entry.url, input);
232
+ return Util.betterMinimatch(entry.url, input);
201
233
  };
202
234
  options.entryFilterHandler = handler;
203
235
  return handler;
@@ -210,7 +242,7 @@ const Util = {
210
242
  const handler = (entry) => {
211
243
  const url = entry.url;
212
244
  for (const pattern of patterns) {
213
- if (minimatch(url, pattern)) {
245
+ if (Util.betterMinimatch(url, pattern)) {
214
246
  return input[pattern];
215
247
  }
216
248
  }
@@ -252,7 +284,7 @@ const Util = {
252
284
  input = obj;
253
285
  } else {
254
286
  const handler = (sourcePath) => {
255
- return minimatch(sourcePath, input);
287
+ return Util.betterMinimatch(sourcePath, input);
256
288
  };
257
289
  options.sourceFilterHandler = handler;
258
290
  return handler;
@@ -264,7 +296,7 @@ const Util = {
264
296
  const patterns = Object.keys(input);
265
297
  const handler = (sourcePath) => {
266
298
  for (const pattern of patterns) {
267
- if (minimatch(sourcePath, pattern)) {
299
+ if (Util.betterMinimatch(sourcePath, pattern)) {
268
300
  return input[pattern];
269
301
  }
270
302
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "2.11.2",
3
+ "version": "2.11.4",
4
4
  "description": "A code coverage tool to generate native V8 reports or Istanbul reports.",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -51,6 +51,7 @@
51
51
  "test-merge": "node ./test/test-merge.js",
52
52
  "test-merge-istanbul": "node ./test/test-merge-istanbul.js",
53
53
  "test-merge-v8": "node ./test/test-merge-v8.js",
54
+ "test-merge-cli": "npx mcr merge -r console-details,v8 --inputDir .temp/code-coverage/raw --outputDir .temp/merge-cli",
54
55
  "test-client": "node ./test/test-client.js",
55
56
  "test-all": "node ./test/test.js",
56
57
  "test-pr": "node --inspect=9230 ./test/test-pr.js",
@@ -95,24 +96,25 @@
95
96
  "convert-source-map": "^2.0.0",
96
97
  "diff-sequences": "^29.6.3",
97
98
  "esbuild": "^0.24.0",
98
- "eslint": "~9.14.0",
99
+ "eslint": "~9.16.0",
99
100
  "eslint-config-plus": "^2.0.2",
100
101
  "eslint-plugin-html": "^8.1.2",
101
- "eslint-plugin-vue": "^9.30.0",
102
+ "eslint-plugin-vue": "^9.32.0",
102
103
  "find-up": "^7.0.0",
103
104
  "minimatch": "^9.0.5",
105
+ "mocha": "^11.0.1",
104
106
  "monocart-code-viewer": "^1.1.4",
105
107
  "monocart-formatter": "^3.0.0",
106
108
  "node-stream-zip": "^1.15.0",
107
- "postcss": "^8.4.47",
109
+ "postcss": "^8.4.49",
108
110
  "starfall-cli": "^2.0.20",
109
- "stylelint": "^16.10.0",
111
+ "stylelint": "^16.11.0",
110
112
  "stylelint-config-plus": "^1.1.3",
111
113
  "supports-color": "^9.4.0",
112
114
  "tsx": "^4.19.2",
113
115
  "turbogrid": "^3.2.0",
114
116
  "vine-ui": "^3.1.16",
115
117
  "ws": "^8.18.0",
116
- "yazl": "^3.2.1"
118
+ "yazl": "^3.3.1"
117
119
  }
118
120
  }