-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathvitest.config.mts
More file actions
44 lines (40 loc) · 1.27 KB
/
vitest.config.mts
File metadata and controls
44 lines (40 loc) · 1.27 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
import { defineConfig, coverageConfigDefaults } from 'vitest/config';
import * as path from 'path';
const MONOREPO_ROOT = path.resolve(__dirname, '.');
const BROWSER_TESTS = ['{docs,packages{-internal,}/*}/vitest.config.browser.mts'];
const NODE_TESTS = ['{docs,packages{-internal,}/*}/vitest.config.mts'];
function getProjects() {
if (process.env.TEST_SCOPE === 'browser') {
return BROWSER_TESTS;
}
if (process.env.TEST_SCOPE === 'node') {
return NODE_TESTS;
}
return [...BROWSER_TESTS, ...NODE_TESTS];
}
/**
* See https://vitest.dev/guide/workspace.html
* > The root configuration will only influence global options such as reporters and coverage.
*/
export default defineConfig({
test: {
projects: getProjects(),
sequence: {
hooks: 'list',
},
coverage: {
provider: 'v8',
reporter: process.env.CI ? ['lcovonly'] : ['text'],
reportsDirectory: path.resolve(MONOREPO_ROOT, 'coverage'),
include: ['packages/*/src/**/*.{mts,ts,tsx,mjs,js,jsx}'],
exclude: [
'**/*.d.ts',
'**/__fixtures__/**',
'packages/mui-icons-material/src/**',
'packages/mui-codemod/src/**/{test-cases,*.test}/**',
'**/{postcss,vitest}.config.*',
...coverageConfigDefaults.exclude,
],
},
},
});