-
Notifications
You must be signed in to change notification settings - Fork 94
/
jest.config.ts
38 lines (33 loc) · 979 Bytes
/
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
import { type Config } from 'jest';
// eslint-disable-next-line @typescript-eslint/naming-convention
export const __esModule = true;
const moduleNameMapper: Config['moduleNameMapper'] = {
'^((?:\\.{1,2}|#[^\\/]*)/.*)\\.[tj]sx?$': '$1',
};
const transform: Config['transform'] = {
'^.+\\.[tj]sx?$': ['@swc/jest', { module: { type: 'commonjs' } }],
};
export default {
extensionsToTreatAsEsm: ['.ts'],
testEnvironment: 'node',
projects: [
{
displayName: 'dom',
moduleNameMapper,
transform,
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/src/**/__tests__/dom.[jt]s?(x)'],
setupFiles: ['./src/__tests__/setup.ts'],
},
{
displayName: 'ssr',
moduleNameMapper,
transform,
testEnvironment: 'node',
testMatch: ['<rootDir>/src/**/__tests__/ssr.[jt]s?(x)'],
},
],
collectCoverage: false,
coverageDirectory: './coverage',
collectCoverageFrom: ['./src/**/*.{ts,js,tsx,jsx}', '!**/__tests__/**', '!**/__docs__/**'],
} satisfies Config;