-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathvitest.config.ts
More file actions
63 lines (59 loc) · 1.76 KB
/
Copy pathvitest.config.ts
File metadata and controls
63 lines (59 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Root vitest config
import pathlib from 'path';
import { defineConfig } from 'vitest/config';
import GithubActionsSummaryReporter from './lib/vitest-reporter/build/test-reporter.js';
const coverageReporters = ['text'];
const testReporters: Exclude<import('vitest/config').ViteUserConfig['test'], undefined>['reporters'] = ['default'];
if (process.env.GITHUB_ACTIONS) {
const reporter = pathlib.resolve(import.meta.dirname, './lib/vitest-reporter/build/coverage-reporter.cjs');
coverageReporters.push(reporter);
testReporters.push(new GithubActionsSummaryReporter());
} else {
coverageReporters.push('html');
}
export default defineConfig({
legacy: {
inconsistentCjsInterop: true
},
resolve: {
alias: [{
find: /^js-slang\/context/,
replacement: pathlib.join(import.meta.dirname, 'src/__mocks__/context.ts')
}]
},
test: {
setupFiles: [pathlib.join(import.meta.dirname, 'vitest.setup.ts')],
projects: [
'./.github/actions',
'./devserver',
'./lib/*',
'./src/bundles/*',
'./src/tabs/*'
],
testTimeout: 20_000,
include: ['**/__tests__/**/*.test.{ts,tsx}'],
exclude: ['**/dist', '**/node_modules'],
reporters: testReporters,
clearMocks: true,
coverage: {
provider: 'v8',
reporter: coverageReporters,
include: [
'./src/{bundles,tabs}/**/*.{ts,tsx}',
'./lib/*/src/**/*.{ts,tsx}',
'./devserver/src/**/*.{ts,tsx}',
'./.github/actions/src/**/*.ts'
],
exclude: [
'**/__mocks__',
'**/__tests__',
'**/__test_mocks__',
'**/build/**',
'**/dist',
'**/samples',
pathlib.join(import.meta.dirname, 'lib/buildtools/src/build/docs/drawdown.ts'),
]
},
silent: 'passed-only'
}
});