-
Notifications
You must be signed in to change notification settings - Fork 4
/
server.jest.config.ts
39 lines (36 loc) · 1.14 KB
/
server.jest.config.ts
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
import {lstatSync, readdirSync} from 'fs';
import path from 'path';
import type {InitialOptionsTsJest} from 'ts-jest/dist/types';
const sharedBasePath = path.resolve(__dirname, 'packages');
const sharedModules = readdirSync(sharedBasePath).filter(name => {
return lstatSync(path.join(sharedBasePath, name)).isDirectory();
});
const config: InitialOptionsTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: ['<rootDir>/tests/setupTests.ts'],
setupFilesAfterEnv: ['jest-extended/all'],
testMatch: ['<rootDir>/**/?(*.)+(spec|test).[jt]s'],
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: 'tsconfig.json',
isolatedModules: false,
},
],
},
testPathIgnorePatterns: ['/node_modules/', '/build/', '/e2e/'],
moduleNameMapper: {
['@bugsnag/(.*)']: '<rootDir>/tests/mocks/empty.js',
...sharedModules.reduce(
(acc, name) => ({
...acc,
[`@unstoppabledomains/${name}/src/(.*)$`]: `<rootDir>/packages/${name}/src/$1`,
[`@unstoppabledomains/${name}(.*)$`]: `<rootDir>/packages/${name}/src/$1`,
}),
{},
),
},
};
export default config;