rickvanlieshout.com/internal/testing/jest-config.ts

37 lines
1.5 KiB
TypeScript
Raw Normal View History

import type { Config } from "@jest/types";
import swc from "./swc-config";
const jestConfig: Config.InitialOptions = {
testEnvironment: "jsdom",
rootDir: "../../",
moduleNameMapper: {
"@/hooks": ["<rootDir>/src/hooks"],
"@/utils": ["<rootDir>/src/utils"],
"@/constants": ["<rootDir>/src/constants"],
"@/utils/([^\\.]*)$": ["<rootDir>/src/utils"],
"@/pages/([^\\.]*)$": ["<rootDir>/src/pages/$1"],
"@/hooks/([^\\.]*)$": ["<rootDir>/src/hooks/$1"],
"@/mocks": ["<rootDir>/internal/testing/__mocks__"],
"@/scss/([^\\.]*)$": ["<rootDir>/src/assets/scss/$1"],
"@/constants/([^\\.]*)$": ["<rootDir>/src/constants/$1"],
"@/images/([^\\.]*)$": ["<rootDir>/src/assets/images/$1"],
"@/components/([^\\.]*)$": ["<rootDir>/src/components/$1"],
".+\\.(css|sass|scss)$": "identity-obj-proxy",
".+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"identity-obj-proxy",
2022-09-05 00:08:04 +02:00
"^gatsby-page-utils/(.*)$": "gatsby-page-utils/$1",
"^gatsby-core-utils/(.*)$": "gatsby-core-utils/dist/$1",
"^gatsby-plugin-utils/(.*)$": [
"gatsby-plugin-utils/dist/$1",
"gatsby-plugin-utils/$1",
],
},
2022-05-25 23:19:08 +02:00
transform: { "^.+\\.[jt]sx?$": ["@swc/jest", swc] },
setupFiles: ["<rootDir>/internal/testing/jest-setup.ts"],
2022-05-25 23:19:08 +02:00
testPathIgnorePatterns: ["node_modules", "\\.cache", "<rootDir>.*/public"],
2022-05-25 22:46:31 +02:00
transformIgnorePatterns: ["node_modules/(?!(gatsby|gatsby-script)/)"],
};
export default jestConfig;