monocart-coverage-reports
Advanced tools
Comparing version 2.11.3 to 2.11.4
@@ -10,3 +10,3 @@ const fs = require('fs'); | ||
// const EC = require('eight-colors'); | ||
const { minimatch, convertSourceMap } = require('../packages/monocart-coverage-vendor.js'); | ||
const { convertSourceMap } = require('../packages/monocart-coverage-vendor.js'); | ||
@@ -41,3 +41,3 @@ // ======================================================================================================== | ||
return (filePath) => { | ||
return minimatch(filePath, input); | ||
return Util.betterMinimatch(filePath, input); | ||
}; | ||
@@ -52,3 +52,3 @@ } | ||
for (const pattern of patterns) { | ||
if (minimatch(filePath, pattern)) { | ||
if (Util.betterMinimatch(filePath, pattern)) { | ||
return input[pattern]; | ||
@@ -55,0 +55,0 @@ } |
const CG = require('console-grid'); | ||
const EC = require('eight-colors'); | ||
const { minimatch } = require('../packages/monocart-coverage-vendor.js'); | ||
const { getGroupedRows } = require('../utils/snapshot.js'); | ||
@@ -81,3 +80,3 @@ const Util = require('../utils/util.js'); | ||
return (file) => { | ||
return minimatch(file.sourcePath, input); | ||
return Util.betterMinimatch(file.sourcePath, input); | ||
}; | ||
@@ -93,3 +92,3 @@ } | ||
for (const pattern of patterns) { | ||
if (minimatch(sourcePath, pattern)) { | ||
if (Util.betterMinimatch(sourcePath, pattern)) { | ||
return input[pattern]; | ||
@@ -96,0 +95,0 @@ } |
@@ -59,2 +59,12 @@ const path = require('path'); | ||
const betterFileURLToPath = (url) => { | ||
try { | ||
url = fileURLToPath(url); | ||
} catch (e) { | ||
url = decodeURIComponent(url); | ||
url = fileURLToPath(url); | ||
} | ||
return url; | ||
}; | ||
const normalizeSourcePath = (sourceUrl, baseDir) => { | ||
@@ -66,3 +76,3 @@ | ||
if (sourceUrl.startsWith('file:')) { | ||
const relPath = Util.relativePath(fileURLToPath(sourceUrl), baseDir); | ||
const relPath = Util.relativePath(betterFileURLToPath(sourceUrl), baseDir); | ||
return filterPath(relPath); | ||
@@ -113,3 +123,3 @@ } | ||
const fileUrl = pathToFileURL(sourceUrl).toString(); | ||
const relPath = Util.relativePath(fileURLToPath(fileUrl), baseDir); | ||
const relPath = Util.relativePath(betterFileURLToPath(fileUrl), baseDir); | ||
return filterPath(relPath); | ||
@@ -116,0 +126,0 @@ }; |
@@ -174,2 +174,34 @@ const fs = require('fs'); | ||
betterMinimatch: (str, pattern) => { | ||
str = `${str}`; | ||
pattern = `${pattern}`; | ||
if (pattern === '*') { | ||
return true; | ||
} | ||
// includes first | ||
if (str.includes(pattern)) { | ||
return true; | ||
} | ||
// with minimatch | ||
if (minimatch(str, pattern)) { | ||
return true; | ||
} | ||
// after decode url | ||
str = decodeURIComponent(str); | ||
if (str.includes(pattern)) { | ||
return true; | ||
} | ||
if (minimatch(str, pattern)) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
// eslint-disable-next-line complexity | ||
@@ -201,3 +233,3 @@ getEntryFilter: (options) => { | ||
const handler = (entry) => { | ||
return minimatch(entry.url, input); | ||
return Util.betterMinimatch(entry.url, input); | ||
}; | ||
@@ -215,3 +247,3 @@ options.entryFilterHandler = handler; | ||
for (const pattern of patterns) { | ||
if (minimatch(url, pattern)) { | ||
if (Util.betterMinimatch(url, pattern)) { | ||
return input[pattern]; | ||
@@ -258,3 +290,3 @@ } | ||
const handler = (sourcePath) => { | ||
return minimatch(sourcePath, input); | ||
return Util.betterMinimatch(sourcePath, input); | ||
}; | ||
@@ -271,3 +303,3 @@ options.sourceFilterHandler = handler; | ||
for (const pattern of patterns) { | ||
if (minimatch(sourcePath, pattern)) { | ||
if (Util.betterMinimatch(sourcePath, pattern)) { | ||
return input[pattern]; | ||
@@ -274,0 +306,0 @@ } |
{ | ||
"name": "monocart-coverage-reports", | ||
"version": "2.11.3", | ||
"version": "2.11.4", | ||
"description": "A code coverage tool to generate native V8 reports or Istanbul reports.", | ||
@@ -99,8 +99,9 @@ "main": "./lib/index.js", | ||
"esbuild": "^0.24.0", | ||
"eslint": "~9.15.0", | ||
"eslint": "~9.16.0", | ||
"eslint-config-plus": "^2.0.2", | ||
"eslint-plugin-html": "^8.1.2", | ||
"eslint-plugin-vue": "^9.31.0", | ||
"eslint-plugin-vue": "^9.32.0", | ||
"find-up": "^7.0.0", | ||
"minimatch": "^9.0.5", | ||
"mocha": "^11.0.1", | ||
"monocart-code-viewer": "^1.1.4", | ||
@@ -111,3 +112,3 @@ "monocart-formatter": "^3.0.0", | ||
"starfall-cli": "^2.0.20", | ||
"stylelint": "^16.10.0", | ||
"stylelint": "^16.11.0", | ||
"stylelint-config-plus": "^1.1.3", | ||
@@ -119,4 +120,4 @@ "supports-color": "^9.4.0", | ||
"ws": "^8.18.0", | ||
"yazl": "^3.3.0" | ||
"yazl": "^3.3.1" | ||
} | ||
} |
@@ -969,2 +969,10 @@ # Monocart Coverage Reports | ||
- Generate additional source and sourcemap files to cache or raw dir | ||
```js | ||
const coverageOptions = { | ||
logging: 'debug', | ||
sourceMap: true | ||
}; | ||
``` | ||
- Show time logs with env `MCR_LOG_TIME` | ||
@@ -971,0 +979,0 @@ ```js |
@@ -972,2 +972,10 @@ # Monocart Coverage Reports | ||
- 生成额外的source和sourcemap文件到cache或raw文件夹 | ||
```js | ||
const coverageOptions = { | ||
logging: 'debug', | ||
sourceMap: true | ||
}; | ||
``` | ||
- 使用环境变量`MCR_LOG_TIME`显示时间日志 | ||
@@ -974,0 +982,0 @@ ```js |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1012907
12094
1174
26