monocart-coverage-reports 2.10.2 → 2.10.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.
- package/README.md +5 -0
- package/README.zh-Hans.md +9 -3
- package/lib/converter/ast-visitor.js +48 -5
- package/lib/converter/converter.js +12 -3
- package/lib/converter/find-original-range.js +33 -10
- package/lib/packages/monocart-coverage-assets.js +1 -1
- package/lib/packages/monocart-coverage-vendor.js +16 -15
- package/lib/reports/custom.js +34 -34
- package/lib/reports/v8-json.js +22 -22
- package/lib/reports/v8.js +51 -51
- package/lib/v8/v8.js +5 -4
- package/package.json +12 -14
package/lib/reports/custom.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const { pathToFileURL } = require('url');
|
|
2
|
-
const Util = require('../utils/util.js');
|
|
3
|
-
|
|
4
|
-
const customReport = async (reportName, reportData, reportOptions, globalOptions) => {
|
|
5
|
-
let CustomReporter;
|
|
6
|
-
let err;
|
|
7
|
-
try {
|
|
8
|
-
CustomReporter = await import(reportName);
|
|
9
|
-
} catch (e) {
|
|
10
|
-
err = e;
|
|
11
|
-
try {
|
|
12
|
-
CustomReporter = await import(pathToFileURL(reportName));
|
|
13
|
-
} catch (ee) {
|
|
14
|
-
err = ee;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!CustomReporter) {
|
|
19
|
-
Util.logError(err.message);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
CustomReporter = CustomReporter.default || CustomReporter;
|
|
24
|
-
|
|
25
|
-
const reporter = new CustomReporter(reportOptions, globalOptions);
|
|
26
|
-
|
|
27
|
-
const results = await reporter.generate(reportData);
|
|
28
|
-
|
|
29
|
-
return results;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = {
|
|
33
|
-
customReport
|
|
34
|
-
};
|
|
1
|
+
const { pathToFileURL } = require('url');
|
|
2
|
+
const Util = require('../utils/util.js');
|
|
3
|
+
|
|
4
|
+
const customReport = async (reportName, reportData, reportOptions, globalOptions) => {
|
|
5
|
+
let CustomReporter;
|
|
6
|
+
let err;
|
|
7
|
+
try {
|
|
8
|
+
CustomReporter = await import(reportName);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
err = e;
|
|
11
|
+
try {
|
|
12
|
+
CustomReporter = await import(pathToFileURL(reportName));
|
|
13
|
+
} catch (ee) {
|
|
14
|
+
err = ee;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!CustomReporter) {
|
|
19
|
+
Util.logError(err.message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
CustomReporter = CustomReporter.default || CustomReporter;
|
|
24
|
+
|
|
25
|
+
const reporter = new CustomReporter(reportOptions, globalOptions);
|
|
26
|
+
|
|
27
|
+
const results = await reporter.generate(reportData);
|
|
28
|
+
|
|
29
|
+
return results;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
customReport
|
|
34
|
+
};
|
package/lib/reports/v8-json.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const Util = require('../utils/util.js');
|
|
3
|
-
|
|
4
|
-
const v8JsonReport = async (reportData, reportOptions, options) => {
|
|
5
|
-
const v8JsonOptions = {
|
|
6
|
-
outputFile: 'coverage-report.json',
|
|
7
|
-
... reportOptions
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// console.log(mergedOptions);
|
|
11
|
-
const jsonPath = path.resolve(options.outputDir, v8JsonOptions.outputFile);
|
|
12
|
-
const reportPath = Util.relativePath(jsonPath);
|
|
13
|
-
|
|
14
|
-
reportData.reportPath = reportPath;
|
|
15
|
-
|
|
16
|
-
await Util.writeFile(jsonPath, JSON.stringify(reportData));
|
|
17
|
-
return reportPath;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
module.exports = {
|
|
21
|
-
v8JsonReport
|
|
22
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const Util = require('../utils/util.js');
|
|
3
|
+
|
|
4
|
+
const v8JsonReport = async (reportData, reportOptions, options) => {
|
|
5
|
+
const v8JsonOptions = {
|
|
6
|
+
outputFile: 'coverage-report.json',
|
|
7
|
+
... reportOptions
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// console.log(mergedOptions);
|
|
11
|
+
const jsonPath = path.resolve(options.outputDir, v8JsonOptions.outputFile);
|
|
12
|
+
const reportPath = Util.relativePath(jsonPath);
|
|
13
|
+
|
|
14
|
+
reportData.reportPath = reportPath;
|
|
15
|
+
|
|
16
|
+
await Util.writeFile(jsonPath, JSON.stringify(reportData));
|
|
17
|
+
return reportPath;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
v8JsonReport
|
|
22
|
+
};
|
package/lib/reports/v8.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const Assets = require('../assets.js');
|
|
3
|
-
|
|
4
|
-
const v8Report = async (reportData, reportOptions, options) => {
|
|
5
|
-
|
|
6
|
-
// V8 only options, merged with root options
|
|
7
|
-
const v8HtmlOptions = {
|
|
8
|
-
outputFile: options.outputFile,
|
|
9
|
-
inline: options.inline,
|
|
10
|
-
assetsPath: options.assetsPath,
|
|
11
|
-
metrics: options.metrics,
|
|
12
|
-
... reportOptions
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// add metrics to data for UI
|
|
16
|
-
reportData.metrics = v8HtmlOptions.metrics;
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
outputFile, inline, assetsPath
|
|
20
|
-
} = v8HtmlOptions;
|
|
21
|
-
|
|
22
|
-
// resolve full report path
|
|
23
|
-
const reportPath = path.resolve(options.outputDir, outputFile);
|
|
24
|
-
const outputDir = path.dirname(reportPath);
|
|
25
|
-
const htmlFile = path.basename(reportPath);
|
|
26
|
-
|
|
27
|
-
const jsFiles = ['monocart-coverage-app'];
|
|
28
|
-
// console.log(jsFiles);
|
|
29
|
-
|
|
30
|
-
const htmlOptions = {
|
|
31
|
-
reportData,
|
|
32
|
-
jsFiles,
|
|
33
|
-
inline,
|
|
34
|
-
assetsPath,
|
|
35
|
-
outputDir,
|
|
36
|
-
htmlFile,
|
|
37
|
-
|
|
38
|
-
saveReportPath: 'reportPath',
|
|
39
|
-
|
|
40
|
-
reportDataFile: 'coverage-data.js'
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// compress json data for html
|
|
44
|
-
const htmlPath = await Assets.saveHtmlReport(htmlOptions);
|
|
45
|
-
|
|
46
|
-
return htmlPath;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
module.exports = {
|
|
50
|
-
v8Report
|
|
51
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const Assets = require('../assets.js');
|
|
3
|
+
|
|
4
|
+
const v8Report = async (reportData, reportOptions, options) => {
|
|
5
|
+
|
|
6
|
+
// V8 only options, merged with root options
|
|
7
|
+
const v8HtmlOptions = {
|
|
8
|
+
outputFile: options.outputFile,
|
|
9
|
+
inline: options.inline,
|
|
10
|
+
assetsPath: options.assetsPath,
|
|
11
|
+
metrics: options.metrics,
|
|
12
|
+
... reportOptions
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// add metrics to data for UI
|
|
16
|
+
reportData.metrics = v8HtmlOptions.metrics;
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
outputFile, inline, assetsPath
|
|
20
|
+
} = v8HtmlOptions;
|
|
21
|
+
|
|
22
|
+
// resolve full report path
|
|
23
|
+
const reportPath = path.resolve(options.outputDir, outputFile);
|
|
24
|
+
const outputDir = path.dirname(reportPath);
|
|
25
|
+
const htmlFile = path.basename(reportPath);
|
|
26
|
+
|
|
27
|
+
const jsFiles = ['monocart-coverage-app'];
|
|
28
|
+
// console.log(jsFiles);
|
|
29
|
+
|
|
30
|
+
const htmlOptions = {
|
|
31
|
+
reportData,
|
|
32
|
+
jsFiles,
|
|
33
|
+
inline,
|
|
34
|
+
assetsPath,
|
|
35
|
+
outputDir,
|
|
36
|
+
htmlFile,
|
|
37
|
+
|
|
38
|
+
saveReportPath: 'reportPath',
|
|
39
|
+
|
|
40
|
+
reportDataFile: 'coverage-data.js'
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// compress json data for html
|
|
44
|
+
const htmlPath = await Assets.saveHtmlReport(htmlOptions);
|
|
45
|
+
|
|
46
|
+
return htmlPath;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
v8Report
|
|
51
|
+
};
|
package/lib/v8/v8.js
CHANGED
|
@@ -193,10 +193,11 @@ const initV8ListAndSourcemap = async (mcr, v8list) => {
|
|
|
193
193
|
|
|
194
194
|
// save source and sourcemap file for debug
|
|
195
195
|
// https://evanw.github.io/source-map-visualization
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
if (options.sourceMap && sourceData.sourceMap) {
|
|
197
|
+
const filePath = cachePath.slice(0, -5);
|
|
198
|
+
await Util.writeFile(`${filePath}.js`, sourceData.source);
|
|
199
|
+
await Util.writeFile(`${filePath}.js.map`, JSON.stringify(sourceData.sourceMap));
|
|
200
|
+
}
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
return v8list;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monocart-coverage-reports",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.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": {
|
|
@@ -10,13 +10,11 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./lib/index.d.ts",
|
|
12
12
|
"import": "./lib/index.mjs",
|
|
13
|
-
"require": "./lib/index.js"
|
|
14
|
-
"default": "./lib/index.js"
|
|
13
|
+
"require": "./lib/index.js"
|
|
15
14
|
},
|
|
16
15
|
"./register": {
|
|
17
16
|
"import": "./lib/register/register.mjs",
|
|
18
|
-
"require": "./lib/register/register.js"
|
|
19
|
-
"default": "./lib/register/register.js"
|
|
17
|
+
"require": "./lib/register/register.js"
|
|
20
18
|
},
|
|
21
19
|
"./converter": "./lib/converter/converter.js",
|
|
22
20
|
"./util": "./lib/utils/util.js",
|
|
@@ -79,11 +77,11 @@
|
|
|
79
77
|
"@jridgewell/sourcemap-codec": "^1.5.0",
|
|
80
78
|
"acorn": "^8.12.1",
|
|
81
79
|
"acorn-loose": "^8.4.0",
|
|
82
|
-
"acorn-walk": "^8.3.
|
|
80
|
+
"acorn-walk": "^8.3.4",
|
|
83
81
|
"commander": "^12.1.0",
|
|
84
82
|
"console-grid": "^2.2.2",
|
|
85
83
|
"eight-colors": "^1.3.0",
|
|
86
|
-
"foreground-child": "^3.
|
|
84
|
+
"foreground-child": "^3.3.0",
|
|
87
85
|
"istanbul-lib-coverage": "^3.2.2",
|
|
88
86
|
"istanbul-lib-report": "^3.0.1",
|
|
89
87
|
"istanbul-reports": "^3.1.7",
|
|
@@ -94,21 +92,21 @@
|
|
|
94
92
|
"async-tick": "^1.0.0",
|
|
95
93
|
"convert-source-map": "^2.0.0",
|
|
96
94
|
"diff-sequences": "^29.6.3",
|
|
97
|
-
"esbuild": "^0.23.
|
|
98
|
-
"eslint": "~9.
|
|
95
|
+
"esbuild": "^0.23.1",
|
|
96
|
+
"eslint": "~9.10.0",
|
|
99
97
|
"eslint-config-plus": "^2.0.2",
|
|
100
98
|
"eslint-plugin-html": "^8.1.1",
|
|
101
|
-
"eslint-plugin-vue": "^9.
|
|
99
|
+
"eslint-plugin-vue": "^9.28.0",
|
|
102
100
|
"find-up": "^7.0.0",
|
|
103
101
|
"minimatch": "^9.0.5",
|
|
104
102
|
"monocart-code-viewer": "^1.1.4",
|
|
105
103
|
"monocart-formatter": "^3.0.0",
|
|
106
|
-
"postcss": "^8.4.
|
|
104
|
+
"postcss": "^8.4.45",
|
|
107
105
|
"starfall-cli": "^2.0.20",
|
|
108
|
-
"stylelint": "^16.
|
|
109
|
-
"stylelint-config-plus": "^1.1.
|
|
106
|
+
"stylelint": "^16.9.0",
|
|
107
|
+
"stylelint-config-plus": "^1.1.3",
|
|
110
108
|
"supports-color": "^9.4.0",
|
|
111
|
-
"tsx": "^4.
|
|
109
|
+
"tsx": "^4.19.0",
|
|
112
110
|
"turbogrid": "^3.2.0",
|
|
113
111
|
"vine-ui": "^3.1.16",
|
|
114
112
|
"ws": "^8.18.0"
|