Files
mudita-center/jest/jest.config.core.js

77 lines
2.4 KiB
JavaScript

const tsPaths = require("../tsconfig.base.json").compilerOptions.paths
module.exports = {
transform: {
"^.+\\.tsx?$": "ts-jest",
},
moduleNameMapper: {
// Add libraries aliases generated by NX
".+\\.(css|styl|less|sass|scss)$": "identity-obj-proxy",
"(.*)svg.component": "<rootDir>/apps/mudita-center/__mocks__/file-mock.js",
".+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/apps/mudita-center/__mocks__/file-mock.js",
...Object.entries(tsPaths).reduce((acc, [alias, [path]]) => {
acc[alias.replace("/*", "/(.*)")] = "<rootDir>/" + path
return acc
}, {}),
"Root/(.*)": "<rootDir>/$1",
"App/(.*)": "<rootDir>/apps/mudita-center/src/$1",
"Core/(.*)": "<rootDir>/libs/core/$1",
"Cypress/(.*)": "<rootDir>/apps/mudita-center/cypress/$1",
"Storybook/(.*)": "<rootDir>/apps/mudita-center/.storybook/$1",
"p-queue$": `${__dirname}/__mocks__/p-queue.ts`,
"react-markdown": "<rootDir>/jest/testing-support/mocks/react-markdown.tsx",
},
rootDir: "../",
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
testPathIgnorePatterns: [
"node_modules",
".cache",
"public",
"cypress",
"libs/(?!core)",
],
globals: {
__PATH_PREFIX__: "",
},
testEnvironmentOptions: {
url: "http://localhost",
},
setupFiles: ["<rootDir>/jest/test-envs.js"],
setupFilesAfterEnv: ["<rootDir>/jest/jest.setup.js"],
roots: ["<rootDir>"],
testResultsProcessor: "<rootDir>/jest/jest.processor.js",
collectCoverage: false,
collectCoverageFrom: [
"src/**/*.{js,ts,tsx}",
"!src/__deprecated__/**",
"!src/__mocks__/**",
"!src/**/__mocks__/**",
"!src/testing-support/**",
"!src/**/*.stories.{js,ts,tsx}",
"!src/**/*.container.{js,ts,tsx}",
"!src/**/*.constant.{js,ts,tsx}",
"!src/**/*.error.{js,ts,tsx}",
"!src/**/*.request.{js,ts,tsx}",
"!src/**/*.module.{js,ts,tsx}",
"!src/**/*.styled.{js,ts,tsx}",
"!src/**/*.interface.{js,ts,tsx}",
"!src/**/*.type.{js,ts,tsx}",
"!src/**/*.enum.{js,ts,tsx}",
"!src/**/*.index.{js,ts,tsx}",
"!src/**/*.d.ts",
],
coverageReporters: ["lcov", "text-summary", "json-summary"],
coverageDirectory: "coverage",
coverageThreshold: {
global: {
lines: 75,
statements: 75,
},
},
snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
}