Skip to content

Instantly share code, notes, and snippets.

@antoniel
Last active February 2, 2022 14:32
Show Gist options
  • Save antoniel/7f6d0c74f71c152645cece48bf37b3ab to your computer and use it in GitHub Desktop.
Save antoniel/7f6d0c74f71c152645cece48bf37b3ab to your computer and use it in GitHub Desktop.
jest.config.js
// yarn add --dev jest @types/jest @swc/core @swc/jest
module.exports = {
testEnvironment: "jsdom",
// setupFilesAfterEnv: ["<rootDir>/src/tests/setupTests.js"], // Uncomment if you need to run setupTests.js
collectCoverage: true,
moduleDirectories: ["node_modules", "<rootDir>"],
collectCoverageFrom: [
"**/*.{js,jsx,ts,tsx}",
"!**/*.d.ts",
"!**/node_modules/**",
"!**/coverage/**",
"!**/pages/**",
"!**/.next/**",
"!*.config.js",
"!**/shared/icons",
],
testMatch: ["**/?(*.)+(spec|test).[jt]s?(x)"],
testPathIgnorePatterns: ["/node_modules/", "/coverage/"],
transform: {
"\\.[jt]sx?$": ["@swc-node/jest", {}],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment