Repository navigation
Expand file tree
/
Copy pathjest.config.js
More file actions
65 lines (60 loc) · 1.61 KB
/
Copy pathjest.config.js
File metadata and controls
65 lines (60 loc) · 1.61 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
64
65
const base = require('../jest.config.base.js');
// MikroORM and its drivers are ESM-only and use import.meta, which does not survive jest's module
// system. So the server is never imported into the jest process: the e2e tests boot it as a real
// subprocess (native ESM) and drive it over HTTP, and jest itself stays plain commonjs. The client
// tests run the framework-free UI under jsdom with a faked axios adapter, no server at all.
const cjsTransform = {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
tsconfig: {
target: 'es2020',
module: 'commonjs',
moduleResolution: 'node',
lib: ['es2020', 'dom', 'dom.iterable'],
esModuleInterop: true,
strict: true,
},
},
],
};
const clientTransform = {
'^.+\\.[tj]sx?$': [
'ts-jest',
{
tsconfig: {
target: 'es2020',
module: 'commonjs',
moduleResolution: 'node',
jsx: 'react-jsx',
lib: ['es2020', 'dom', 'dom.iterable'],
esModuleInterop: true,
strict: true,
},
},
],
};
const common = {
moduleFileExtensions: base.moduleFileExtensions,
moduleNameMapper: base.moduleNameMapper,
transform: cjsTransform,
clearMocks: true,
};
module.exports = {
projects: [
{
...common,
displayName: 'e2e',
testEnvironment: 'node',
testMatch: ['<rootDir>/e2e/**/*.spec.ts'],
},
{
...common,
transform: clientTransform,
displayName: 'client',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/client/**/*.spec.tsx'],
setupFilesAfterEnv: ['<rootDir>/jest.setup.client.ts'],
},
],
};