-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
41 lines (40 loc) · 1.01 KB
/
jest.config.js
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
// @ts-expect-error alias-hq does not have type definitions...
import hq from 'alias-hq'
/**
* @type {import('jest').Config}
*/
export default {
extensionsToTreatAsEsm: ['.ts'],
testEnvironment: 'node',
resolver: '<rootDir>/jest.resolver.cjs',
testPathIgnorePatterns: [
'/node_modules/',
'/apps/web/.next/',
'/apps/web/out/',
],
watchPathIgnorePatterns: [
'\\.gen\\.d\\.ts',
'\\.gen\\.ts',
'\\.gen\\.json',
'\\.schema\\.json',
],
testRegex: '\\.(spec|test)\\.[jt]sx?$',
transform: {
'^.+\\.(js|ts|tsx)$': [
'esbuild-jest',
{
sourcemap: true,
target: 'node20',
format: 'esm',
},
],
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
// https://github.com/davestewart/alias-hq/blob/main/docs/api/api.md
// maybe this would be a reason to use ts-jest which has native support for pathsToModuleNameMapper
// instead of esbuild-jest which does not?
moduleNameMapper: hq.get('jest'),
}