Coverage issue with mono-repo #6586
-
I have a mono repo, where I use esbuild for the bundling and vitest for the tests and all is good, I am now trying to enable coverage and am hitting what I think is a pathing / alias issue. Here is my import { defineConfig } from "vitest/config";
export default defineConfig(({ mode }) => {
switch (mode) {
case "node":
return {
test: {
include: [
"tests/*.spec.ts",
"tests/node/*.spec.ts"
],
node: {
enabled: true,
provider: "node",
},
testTimeout: 20000,
coverage: {
provider: "v8",
allowExternal: true,
// include: ["src/**/*.ts"],
reporter: ["json", "text"]
}
}
};
... And here is the output for a coverage run in -------------------------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------------------------|---------|----------|---------|---------|-------------------
All files | 68.79 | 76.78 | 69.23 | 68.79 |
build/build/packages/base91/src-cpp | 100 | 74.15 | 65.27 | 100 |
base91lib.js | 100 | 70.88 | 63.76 | 100 | 3,9
base91lib.wasm | 100 | 100 | 100 | 100 |
build/packages/base91/src | 100 | 100 | 100 | 100 |
base91.ts | 100 | 100 | 100 | 100 |
wasm-library.ts | 100 | 100 | 100 | 100 |
packages/base91 | 0 | 0 | 0 | 0 |
esbuild.js | 0 | 0 | 0 | 0 | 1-4
packages/base91/src | 0 | 33.33 | 33.33 | 0 |
base91.ts | 0 | 0 | 0 | 0 | 1-101
index.ts | 0 | 0 | 0 | 0 | 1
wasm-library.ts | 0 | 100 | 100 | 0 | 10-59
-------------------------------------|---------|----------|---------|---------|------------------- So it is calculating the coverage correctly for the top half with invalid paths, while skipping the bottom half which has the correct pathing. Suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Seeing a path like |
Beta Was this translation helpful? Give feedback.
Seeing a path like
build/build/...
, it might be a same source map issue as #6526. It should be fixed in latest Vite, but not released yet.