Fix vitest junit coverage runs

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-09-21 10:33:50 +02:00
parent c35a066368
commit 280b255529
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
3 changed files with 4 additions and 21 deletions

View file

@ -134,7 +134,7 @@ vitest:
before_script: before_script:
- yarn --cwd "js" install --frozen-lockfile - yarn --cwd "js" install --frozen-lockfile
script: script:
- yarn --cwd "js" run coverage --reporter=junit --outputFile.junit=./js/junit.xml - yarn --cwd "js" run coverage --reporter=default --reporter=junit --outputFile.junit=./js/junit.xml
artifacts: artifacts:
when: always when: always
paths: paths:

View file

@ -1,20 +0,0 @@
module.exports = {
preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel",
collectCoverage: true,
collectCoverageFrom: [
"**/*.{vue,ts}",
"!**/node_modules/**",
"!get_union_json.ts",
],
coverageReporters: ["html", "text", "text-summary"],
reporters: ["default", "jest-junit"],
// The following should fix the issue with svgs and ?inline loader (see Logo.vue), but doesn't work
//
// transform: {
// "^.+\\.svg$": "<rootDir>/tests/unit/svgTransform.js",
// },
// moduleNameMapper: {
// "^@/(.*svg)(\\?inline)$": "<rootDir>/src/$1",
// "^@/(.*)$": "<rootDir>/src/$1",
// },
};

View file

@ -74,6 +74,9 @@ export default defineConfig(({ command }) => {
"@": path.resolve(__dirname, "./src"), "@": path.resolve(__dirname, "./src"),
}, },
}, },
coverage: {
reporter: ["text", "json", "html"],
},
setupFiles: path.resolve(__dirname, "./tests/unit/setup.ts"), setupFiles: path.resolve(__dirname, "./tests/unit/setup.ts"),
include: [path.resolve(__dirname, "./tests/unit/specs/**/*.spec.ts")], include: [path.resolve(__dirname, "./tests/unit/specs/**/*.spec.ts")],
}, },