-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathjest.config.js
More file actions
61 lines (61 loc) · 2.62 KB
/
Copy pathjest.config.js
File metadata and controls
61 lines (61 loc) · 2.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
58
59
60
61
/** @type {import('jest').Config} **/
module.exports = {
// Limit workers to avoid OOM kills on machines with many cores.
maxWorkers: '25%',
// Exclude VS Code test binaries downloaded by @vscode/test-electron.
// They contain package.json files whose "name" fields collide with real
// workspace packages, triggering jest-haste-map "naming collision" warnings.
modulePathIgnorePatterns: ['<rootDir>/.vscode-test'],
projects: [
{
displayName: 'extension',
testEnvironment: 'node',
testMatch: ['<rootDir>/src/**/*.test.ts'],
// @swc/jest transpiles without type-checking, avoiding ts-jest's
// per-worker TypeScript compiler (~500MB+) which was causing OOM in CI.
// Options are inlined (not read from .swcrc) because @swc/jest's strict
// JSON parser rejects the trailing commas in .swcrc that swc-loader tolerates.
transform: {
'^.+\\.tsx?$': [
'@swc/jest',
{
sourceMaps: 'inline',
module: { type: 'commonjs' },
jsc: {
target: 'es2021',
baseUrl: __dirname,
parser: {
syntax: 'typescript',
tsx: true,
functionBind: false,
decorators: true,
dynamicImport: true,
},
transform: {
react: {
runtime: 'automatic',
},
},
},
},
],
},
},
// React components in the webviews need a DOM. Kept as its own project rather than
// switching the extension project to jsdom, which would change the environment under
// every existing host-side test.
{
displayName: 'extension-webview',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/src/webviews/**/*.test.tsx'],
transform: {
'^.+\\.tsx?$': ['ts-jest', {}],
},
},
'<rootDir>/packages/documentdb-js-schema-analyzer',
'<rootDir>/packages/documentdb-js-operator-registry',
'<rootDir>/packages/documentdb-js-shell-runtime',
'<rootDir>/packages/vscode-ext-webview',
'<rootDir>/packages/vscode-ext-webview-fluentui',
],
};