Skip to content

Commit c99caab

Browse files
committed
Configure test coverage
1 parent dacf2f9 commit c99caab

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

vitest.config.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
11
import { resolve } from 'node:path';
2-
import { URL, fileURLToPath } from 'node:url';
32
import { defineConfig } from 'vitest/config';
43

5-
const __dirname: string = fileURLToPath(new URL('.', import.meta.url));
6-
4+
// https://vitejs.dev/config/
75
export default defineConfig({
86
resolve: {
97
alias: {
10-
src: resolve(__dirname, './src'),
11-
tests: resolve(__dirname, './tests'),
8+
src: resolve(import.meta.dirname, './src'),
9+
tests: resolve(import.meta.dirname, './tests'),
10+
},
11+
},
12+
test: {
13+
coverage: {
14+
all: true,
15+
provider: 'v8',
16+
reporter: ['clover', 'cobertura', 'json-summary', 'json', 'lcov', 'text'],
17+
include: ['src'],
18+
reportOnFailure: true,
19+
thresholds: {
20+
lines: 90,
21+
statements: 90,
22+
functions: 90,
23+
branches: 90,
24+
},
1225
},
26+
reporters: process.env.CI_PREFLIGHT
27+
? ['basic', 'github-actions']
28+
: ['basic'],
1329
},
1430
});

0 commit comments

Comments
 (0)