Repository navigation
Expand file tree
/
Copy pathvitest.config.js
More file actions
41 lines (39 loc) · 1.76 KB
/
Copy pathvitest.config.js
File metadata and controls
41 lines (39 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
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vitest/config';
const isIntegrationRun = process.env.CAMUNDA_SDK_INTEGRATION === '1';
export default defineConfig(() => {
return {
resolve: {
// Source-time resolution of the #platform subpath import (package.json "imports"
// points at dist/, which does not exist when unit tests run).
alias: {
'#platform': fileURLToPath(new URL('./src/runtime/platform/node.ts', import.meta.url)),
},
},
test: {
globals: true,
// Integration tests share a live Camunda instance, so they must run
// sequentially. Unit runs have no shared external state — let vitest
// parallelize across files (default) for a large wall-time win.
//
// Only set `fileParallelism` for integration runs. Setting it to
// `undefined` for unit runs would still add the key to the config, which
// vitest may treat as an explicit override and suppress the default
// parallel behavior — so omit the key entirely instead.
...(isIntegrationRun ? { fileParallelism: false } : {}),
// Only run cleanup (or environment provisioning) for integration runs.
// As with `fileParallelism`, omit these keys entirely for unit runs
// rather than setting them to `undefined`, so vitest never sees an
// explicit override.
...(isIntegrationRun
? {
setupFiles: './tests-integration/setup/cleanup.ts',
globalSetup: './tests-integration/setup/global-setup.ts',
}
: {}),
// Integration tests disable cross-file parallelism (via `fileParallelism`
// above) so that shared resources (e.g., the Camunda Platform instance)
// are not hit by concurrent test files.
},
};
});