forked from getAlby/lightning-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
43 lines (41 loc) · 1.17 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
42
43
/** @type {import('@jest/types').Config.InitialOptions} */
// we need this to avoid conflcits with .scwrc
// - `jsc`-entry isn't recognized
// - `env`-entry is recognized but supporting our build targets breaks tests
const swcConfig = {
jsc: {
transform: {
react: {
runtime: "automatic",
},
},
target: "es2016",
},
env: {
targets: "",
},
};
// eslint-disable-next-line no-undef
module.exports = {
verbose: true,
transform: {
"^.+\\.mjs?$": [
// "dexie" needs this
"@swc/jest",
swcConfig,
],
"^.+\\.(t|j)sx?$": ["@swc/jest", swcConfig],
},
transformIgnorePatterns: ["node_modules/(?!(@runcitadel))/"],
moduleNameMapper: {
// needs to align with "tsconfig.json"-paths
// swc does not provide "pathsToModuleNameMapper" as ts-jest does
"^~/(.*)$": "<rootDir>/src/$1",
"^@components/(.*)$": "<rootDir>/src/app/components/$1",
"^@screens/(.*)$": "<rootDir>/src/app/screens/$1",
},
setupFiles: ["jest-webextension-mock", "fake-indexeddb/auto"],
testEnvironment: "./jest.custom-test-environment.js",
setupFilesAfterEnv: ["./jest.setup.js"],
modulePathIgnorePatterns: ["<rootDir>/tests"],
};