2022-06-27 16:41:03 +02:00
|
|
|
// Sync object
|
|
|
|
/** @type {import('@jest/types').Config.InitialOptions} */
|
|
|
|
const config = {
|
|
|
|
roots: ["<rootDir>/src"],
|
|
|
|
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts"],
|
2022-07-19 10:40:02 +02:00
|
|
|
reporters: [
|
2022-07-25 10:13:47 +02:00
|
|
|
"default",
|
2022-07-19 10:40:02 +02:00
|
|
|
[
|
|
|
|
"jest-junit",
|
|
|
|
{
|
|
|
|
outputDirectory: "dist-tests/test-results/jest",
|
|
|
|
outputName: "jest.xml",
|
|
|
|
includeShortConsoleOutput: true,
|
|
|
|
classNameTemplate: "{classname}-{title}",
|
|
|
|
titleTemplate: "{classname}-{title}",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
2022-06-27 16:41:03 +02:00
|
|
|
setupFiles: ["react-app-polyfill/jsdom"],
|
|
|
|
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
|
2022-07-08 15:05:05 +02:00
|
|
|
testMatch: [
|
|
|
|
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
|
|
|
|
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}",
|
|
|
|
],
|
2022-06-27 16:41:03 +02:00
|
|
|
testEnvironment: "jsdom",
|
|
|
|
transform: {
|
|
|
|
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js",
|
|
|
|
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
|
|
|
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js",
|
|
|
|
},
|
|
|
|
transformIgnorePatterns: [
|
|
|
|
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$",
|
|
|
|
"^.+\\.module\\.(css|sass|scss)$",
|
|
|
|
],
|
|
|
|
modulePaths: [],
|
|
|
|
moduleNameMapper: {
|
|
|
|
"^react-native$": "react-native-web",
|
|
|
|
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
|
|
|
|
},
|
2022-07-08 15:05:05 +02:00
|
|
|
moduleFileExtensions: [
|
|
|
|
"web.js",
|
|
|
|
"js",
|
|
|
|
"web.ts",
|
|
|
|
"ts",
|
|
|
|
"web.tsx",
|
|
|
|
"tsx",
|
|
|
|
"json",
|
|
|
|
"web.jsx",
|
|
|
|
"jsx",
|
|
|
|
"node",
|
|
|
|
],
|
2022-06-27 16:41:03 +02:00
|
|
|
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
|
|
|
|
resetMocks: true,
|
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
"node_modules",
|
|
|
|
"test-config",
|
|
|
|
"jestGlobalMocks.ts",
|
|
|
|
".module.ts",
|
|
|
|
".mock.ts",
|
|
|
|
"reportWebVitals.ts",
|
|
|
|
"<rootDir>/src/app/hooks.ts",
|
|
|
|
"<rootDir>/src/app/store.ts",
|
|
|
|
"<rootDir>/src/App.tsx",
|
|
|
|
"<rootDir>/src/index.tsx",
|
|
|
|
"<rootDir>/src/features/counter/*",
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = config;
|
|
|
|
|
|
|
|
// Or async function
|
|
|
|
module.exports = async () => {
|
|
|
|
return config;
|
|
|
|
};
|