monocart-coverage-reports 2.12.2 → 2.12.3

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/lib/cli.js CHANGED
@@ -93,10 +93,10 @@ const initNodeOptions = async (cliOptions) => {
93
93
  // export source after
94
94
  if (preloadType === '--import') {
95
95
  const importPath = getRegisterPath('register.mjs');
96
- nodeOptions.push(`--import ${importPath}`);
96
+ nodeOptions.unshift(`--import ${importPath}`);
97
97
  } else {
98
98
  const requirePath = getRegisterPath('register.js');
99
- nodeOptions.push(`--require ${requirePath}`);
99
+ nodeOptions.unshift(`--require ${requirePath}`);
100
100
  }
101
101
 
102
102
  // console.log(nodeOptions);
@@ -1136,6 +1136,56 @@ const generateCoverageForDist = (state) => {
1136
1136
 
1137
1137
  };
1138
1138
 
1139
+ const handleUncoveredInCovered = (state, originalStateMap) => {
1140
+ if (!state.fake) {
1141
+ return;
1142
+ }
1143
+
1144
+ // fake statements/branches/functions
1145
+ originalStateMap.forEach((originalState) => {
1146
+ const { bytes } = originalState;
1147
+ const list = [];
1148
+ originalState.bytes = bytes.filter((item) => {
1149
+ if (item.count === 0) {
1150
+ const range = bytes.find((it) => {
1151
+ if (it.count === 0) {
1152
+ return false;
1153
+ }
1154
+ if (it.start > item.end) {
1155
+ return false;
1156
+ }
1157
+ if (it.end < item.start) {
1158
+ return false;
1159
+ }
1160
+ return true;
1161
+ });
1162
+ if (range) {
1163
+ list.push(item);
1164
+ return false;
1165
+ }
1166
+ }
1167
+ return true;
1168
+ });
1169
+
1170
+ if (!list.length) {
1171
+ return;
1172
+ }
1173
+
1174
+ list.forEach((item) => {
1175
+ ['statements', 'branches', 'functions'].forEach((key) => {
1176
+ originalState[key] = originalState[key].filter((it) => {
1177
+ if (it.start === item.start && it.end === item.end) {
1178
+ return false;
1179
+ }
1180
+ return true;
1181
+ });
1182
+ });
1183
+ });
1184
+
1185
+ });
1186
+
1187
+ };
1188
+
1139
1189
  const unpackSourceMap = (state, options) => {
1140
1190
 
1141
1191
  const { sourceMap, sourcePath } = state;
@@ -1186,6 +1236,9 @@ const unpackSourceMap = (state, options) => {
1186
1236
  handleOriginalBytesCoverage(originalState);
1187
1237
  });
1188
1238
 
1239
+ // remove uncovered in covered for fake
1240
+ handleUncoveredInCovered(state, originalStateMap);
1241
+
1189
1242
  // collect coverage for original list
1190
1243
  collectOriginalList(state, originalStateMap);
1191
1244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-coverage-reports",
3
- "version": "2.12.2",
3
+ "version": "2.12.3",
4
4
  "description": "A code coverage tool to generate native V8 reports or Istanbul reports.",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -62,9 +62,6 @@
62
62
  "patch": "npm run build && npm run test && npx sf publish patch -r",
63
63
  "beta": "npm version prerelease --preid=beta && npm run build && npm run test && npm publish --tag beta"
64
64
  },
65
- "workspaces": [
66
- "test"
67
- ],
68
65
  "files": [
69
66
  "lib",
70
67
  "README.zh-Hans.md"
@@ -75,7 +72,7 @@
75
72
  "url": "git+https://github.com/cenfun/monocart-coverage-reports.git"
76
73
  },
77
74
  "dependencies": {
78
- "acorn": "^8.14.0",
75
+ "acorn": "^8.14.1",
79
76
  "acorn-loose": "^8.4.0",
80
77
  "acorn-walk": "^8.3.4",
81
78
  "commander": "^13.1.0",
@@ -89,28 +86,48 @@
89
86
  "monocart-locator": "^1.0.2"
90
87
  },
91
88
  "devDependencies": {
89
+ "@actions/core": "^1.11.1",
90
+ "@actions/github": "^6.0.0",
92
91
  "@jridgewell/sourcemap-codec": "^1.5.0",
92
+ "@jsdevtools/coverage-istanbul-loader": "^3.0.5",
93
+ "@rollup/plugin-commonjs": "^28.0.3",
94
+ "@rollup/plugin-typescript": "^12.1.2",
93
95
  "async-tick": "^1.0.0",
96
+ "babel-loader": "^10.0.0",
97
+ "babel-plugin-istanbul": "^7.0.0",
94
98
  "convert-source-map": "^2.0.0",
99
+ "cross-env": "^7.0.3",
95
100
  "diff-sequences": "^29.6.3",
96
- "esbuild": "^0.25.0",
97
- "eslint": "~9.21.0",
101
+ "esbuild": "^0.25.1",
102
+ "eslint": "~9.22.0",
98
103
  "eslint-config-plus": "^2.0.2",
99
104
  "eslint-plugin-html": "^8.1.2",
100
- "eslint-plugin-vue": "^9.32.0",
105
+ "eslint-plugin-vue": "^10.0.0",
101
106
  "find-up": "^7.0.0",
107
+ "foreground-child": "^3.3.1",
108
+ "koa": "^2.16.0",
109
+ "koa-static-resolver": "^1.0.6",
102
110
  "minimatch": "^9.0.5",
103
111
  "mocha": "^11.1.0",
104
112
  "monocart-code-viewer": "^1.1.5",
105
113
  "monocart-formatter": "^3.0.1",
106
114
  "node-stream-zip": "^1.15.0",
115
+ "open": "^10.1.0",
116
+ "playwright": "^1.51.0",
107
117
  "postcss": "^8.5.3",
118
+ "puppeteer": "^24.4.0",
119
+ "rollup": "^4.35.0",
108
120
  "starfall-cli": "^2.0.21",
109
- "stylelint": "^16.14.1",
121
+ "stylelint": "^16.15.0",
110
122
  "stylelint-config-plus": "^1.1.3",
111
123
  "supports-color": "^10.0.0",
124
+ "swc-loader": "^0.2.6",
125
+ "ts-loader": "^9.5.2",
126
+ "tsx": "^4.19.3",
112
127
  "turbogrid": "^3.2.0",
128
+ "typescript": "^5.8.2",
113
129
  "vine-ui": "^3.1.16",
130
+ "webpack": "^5.98.0",
114
131
  "ws": "^8.18.1",
115
132
  "yazl": "^3.3.1"
116
133
  }