-
Notifications
You must be signed in to change notification settings - Fork 25
/
jest.config.js
46 lines (44 loc) · 1.41 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
44
45
46
const esModules = ["@stellar/design-system"];
const jsdomTests = {
rootDir: __dirname,
roots: ["./", "./extension", "./@shared/api", "./@stellar/freighter-api"],
collectCoverageFrom: ["src/**/*.{ts,tsx,mjs}"],
setupFiles: [
"<rootDir>/config/jest/setupTests.tsx",
"<rootDir>/node_modules/jest-canvas-mock",
],
setupFilesAfterEnv: [
"<rootDir>/config/jest/extendJest.ts",
"@testing-library/jest-dom",
],
testEnvironmentOptions: {
url: "http://localhost",
},
transform: {
"^.+\\.(js|jsx|ts|tsx|mjs)$": ["babel-jest"],
},
transformIgnorePatterns: [`/node_modules/(?!${esModules.join("|")})`],
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/config/jest/__mocks__/fileMock.ts",
"^.+\\.svg\\?(react)(.+)?$": "<rootDir>/config/jest/__mocks__/fileMock.ts",
"\\.(scss|css)$": "<rootDir>/config/jest/__mocks__/styleMock.ts",
},
moduleFileExtensions: ["js", "jsx", "json", "node", "mjs", "ts", "tsx"],
moduleDirectories: ["node_modules", "<rootDir>/extension/src", "<rootDir>/."],
testEnvironment: "jsdom",
resolver: "<rootDir>/config/jest/resolver.js",
modulePathIgnorePatterns: ["extension/e2e-tests"],
};
module.exports = {
projects: [
{
displayName: "jsdom",
...jsdomTests,
},
{
displayName: "node",
testMatch: ["<rootDir>/testNodeCompat.js"],
},
],
};