monocart-coverage-reports 1.0.7 → 1.0.8

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 CHANGED
@@ -101,7 +101,7 @@ console.log(coverageResults.summary);
101
101
  | :--------------| :------ | :------ | :---------------------- |
102
102
  | Input | Istanbul (Object) | V8 (Array) | V8 (Array) |
103
103
  | Output | [Istanbul HTML report](https://cenfun.github.io/monocart-coverage-reports/istanbul) | [V8 HTML report](https://cenfun.github.io/monocart-coverage-reports/v8) | [Istanbul HTML report](https://cenfun.github.io/monocart-coverage-reports/v8-and-istanbul/istanbul) |
104
- | Indicators | Covered Lines, Branches, Statements and Functions, Execution Counts | Covered Bytes, Lines❔, Execution Counts | Covered Lines, Branches❔, Statements and Functions, Execution Counts |
104
+ | Indicators | Covered Lines, Branches, Statements and Functions, Execution Counts | Covered Bytes, Lines❔, Execution Counts | Covered Lines, Branches❔, Statements and Functions❔, Execution Counts |
105
105
  | CSS coverage | ❌ | ✅ | ✅ |
106
106
  | Minified code | N/A | ✅ | ❌ |
107
107
  | Code formatting | N/A | ✅ | ❌ |
@@ -115,7 +115,7 @@ console.log(coverageResults.summary);
115
115
  - 3, Generating coverage report.
116
116
 
117
117
  - V8 Workflows
118
- - 1, For any runtime code: nothing to do. For source code: building code with `development` mode and sourcemap support, see [webpack.config-v8.js](https://github.com/cenfun/monocart-coverage-reports/blob/main/mock/webpack.config-v8.js).
118
+ - 1, For any runtime code: nothing to do. For source code: building code with `development` [mode](https://webpack.js.org/configuration/mode/) and [sourcemap](https://webpack.js.org/configuration/devtool/) support, see [webpack.config-v8.js](https://github.com/cenfun/monocart-coverage-reports/blob/main/mock/webpack.config-v8.js).
119
119
  - 2, Collecting coverage data with [Chromium Coverage API](#chromium-coverage-api), see [example](https://github.com/cenfun/monocart-coverage-reports/blob/main/tests/test-v8.js).
120
120
  - 3, Generating coverage report.
121
121
 
package/lib/utils/util.js CHANGED
@@ -103,6 +103,34 @@ const Util = {
103
103
  return htmlPathHandler();
104
104
  },
105
105
 
106
+ resolveNodeModule: (p) => {
107
+ // same level dep
108
+ const dep = path.resolve(__dirname, '../../../', p);
109
+ if (fs.existsSync(dep)) {
110
+ return dep;
111
+ }
112
+
113
+ // root
114
+ const cwd = path.resolve('node_modules', p);
115
+ if (fs.existsSync(cwd)) {
116
+ return cwd;
117
+ }
118
+
119
+ // sub node modules
120
+ const sub = path.resolve(__dirname, '../../node_modules', p);
121
+ if (fs.existsSync(sub)) {
122
+ return sub;
123
+ }
124
+
125
+ Util.logError(`Not found module: ${p}`);
126
+
127
+ return cwd;
128
+ },
129
+
130
+ resolvePackage: (p) => {
131
+ return path.resolve(__dirname, '../packages', p);
132
+ },
133
+
106
134
  saveHtmlReport: async (options) => {
107
135
 
108
136
  const {
package/lib/v8/v8.js CHANGED
@@ -180,11 +180,11 @@ const saveV8HtmlReport = async (reportData, options, v8MergedOptions) => {
180
180
 
181
181
  // deps
182
182
  const jsFiles = ['monocart-code-viewer', 'monocart-formatter', 'turbogrid'].map((it) => {
183
- return path.resolve(`node_modules/${it}/dist/${it}.js`);
183
+ return Util.resolveNodeModule(`${it}/dist/${it}.js`);
184
184
  });
185
185
 
186
186
  // package v8 ui
187
- jsFiles.push(path.resolve(__dirname, '../packages/monocart-coverage-v8.js'));
187
+ jsFiles.push(Util.resolvePackage('monocart-coverage-v8.js'));
188
188
 
189
189
  // console.log(jsFiles);
190
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Monocart coverage reports",
5
5
  "main": "lib/index.js",
6
6
  "exports": {
@@ -52,12 +52,12 @@
52
52
  "eslint-config-plus": "^1.0.6",
53
53
  "eslint-plugin-html": "^7.1.0",
54
54
  "eslint-plugin-vue": "^9.19.2",
55
- "github-markdown-css": "^5.4.0",
55
+ "github-markdown-css": "^5.5.0",
56
56
  "koa": "^2.14.2",
57
57
  "koa-static-resolver": "^1.0.4",
58
- "marked": "^11.0.0",
58
+ "marked": "^11.0.1",
59
59
  "playwright": "^1.40.1",
60
- "stylelint": "^15.11.0",
60
+ "stylelint": "^16.0.2",
61
61
  "stylelint-config-plus": "^1.0.4",
62
62
  "webpack": "^5.89.0",
63
63
  "webpack-cli": "^5.1.4"