-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Expand file tree
/
Copy pathvitest.config.ts
More file actions
57 lines (51 loc) · 1.62 KB
/
vitest.config.ts
File metadata and controls
57 lines (51 loc) · 1.62 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
import { coverageConfigDefaults, defineConfig } from 'vitest/config';
/**
* CircleCI reports the wrong number of threads to Node.js, so we need to set it manually. Unit
* tests are running with the xlarge resource class, which has 8 vCPUs.
*
* @see https://jahed.dev/2022/11/20/fixing-node-js-multi-threading-on-circleci/
* @see https://vitest.dev/config/maxworkers.html#maxworkers
* @see https://circleci.com/docs/configuration-reference/#x86
* @see .circleci/config.yml#L187
*/
const threadCount = process.env.CI ? (process.platform === 'win32' ? 4 : 7) : undefined;
const shouldRunStorybookTests = !(process.env.CI && process.platform === 'win32');
const projects = [
'code/addons/*/vitest.config.ts',
'code/frameworks/*/vitest.config.ts',
'code/lib/*/vitest.config.ts',
'code/core/vitest.config.ts',
'code/builders/*/vitest.config.ts',
'code/presets/*/vitest.config.ts',
'code/renderers/*/vitest.config.ts',
'scripts/vitest.config.ts',
];
/**
* On CI, we run our own unit tests, but for performance reasons, we don't install playwright, thus
* these tests, that need browser-mode cannot be run/added
*/
if (shouldRunStorybookTests) {
projects.push('code/vitest.config.storybook.ts');
}
export default defineConfig({
test: {
env: {
NODE_ENV: 'test',
},
pool: 'threads',
maxWorkers: threadCount,
projects,
coverage: {
provider: 'istanbul',
exclude: [
...coverageConfigDefaults.exclude,
'**/__mocks/**',
'**/dist/**',
'playwright.config.ts',
'vitest-setup.ts',
'vitest.helpers.ts',
'**/*.stories.*',
],
},
},
});