@vitest/coverage-istanbul 1.2.0 → 1.2.2
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/dist/provider.js +17 -1
- package/package.json +3 -3
package/dist/provider.js
CHANGED
@@ -262,7 +262,7 @@ class IstanbulCoverageProvider extends BaseCoverageProvider {
|
|
262
262
|
perFile: this.options.thresholds.perFile,
|
263
263
|
configurationFile: {
|
264
264
|
write: () => writeFileSync(configFilePath, configModule.generate().code, "utf-8"),
|
265
|
-
read: () => configModule
|
265
|
+
read: () => resolveConfig(configModule)
|
266
266
|
}
|
267
267
|
});
|
268
268
|
}
|
@@ -329,5 +329,21 @@ function toSlices(array, size) {
|
|
329
329
|
return chunks;
|
330
330
|
}, []);
|
331
331
|
}
|
332
|
+
function resolveConfig(configModule) {
|
333
|
+
const mod = configModule.exports.default;
|
334
|
+
try {
|
335
|
+
if (mod.$type === "object")
|
336
|
+
return mod;
|
337
|
+
if (mod.$type === "function-call") {
|
338
|
+
if (mod.$args[0].$type === "object")
|
339
|
+
return mod.$args[0];
|
340
|
+
if (mod.$args[0].$type === "arrow-function-expression" && mod.$args[0].$body.$type === "object")
|
341
|
+
return mod.$args[0].$body;
|
342
|
+
}
|
343
|
+
} catch (error) {
|
344
|
+
throw new Error(error instanceof Error ? error.message : String(error));
|
345
|
+
}
|
346
|
+
throw new Error("Failed to update coverage thresholds. Configuration file is too complex.");
|
347
|
+
}
|
332
348
|
|
333
349
|
export { IstanbulCoverageProvider };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/coverage-istanbul",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.2",
|
5
5
|
"description": "Istanbul coverage provider for Vitest",
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
7
7
|
"license": "MIT",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"istanbul-lib-report": "^3.0.1",
|
47
47
|
"istanbul-lib-source-maps": "^4.0.1",
|
48
48
|
"istanbul-reports": "^3.1.6",
|
49
|
-
"magicast": "^0.3.
|
49
|
+
"magicast": "^0.3.3",
|
50
50
|
"picocolors": "^1.0.0",
|
51
51
|
"test-exclude": "^6.0.0"
|
52
52
|
},
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"@types/istanbul-lib-source-maps": "^4.0.4",
|
59
59
|
"@types/istanbul-reports": "^3.0.4",
|
60
60
|
"pathe": "^1.1.1",
|
61
|
-
"vitest": "1.2.
|
61
|
+
"vitest": "1.2.2"
|
62
62
|
},
|
63
63
|
"scripts": {
|
64
64
|
"build": "rimraf dist && rollup -c",
|