Skip to content

Instantly share code, notes, and snippets.

@manuartero
Created May 27, 2025 17:20
Show Gist options
  • Save manuartero/e09a9a8ee16958490f5ae9036ad85acf to your computer and use it in GitHub Desktop.
Save manuartero/e09a9a8ee16958490f5ae9036ad85acf to your computer and use it in GitHub Desktop.
jest.config.mjs
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
/** @type {import('jest').Config} */
const config = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ["src/**"],
coverageDirectory: "coverage",
coverageProvider: "v8",
moduleDirectories: ["node_modules", "src"], // @see https://stackoverflow.com/a/51174924/1614677
preset: "ts-jest",
resetMocks: true,
restoreMocks: true,
roots: ["<rootDir>/src"],
testEnvironment: "jsdom",
testMatch: ["**/?(*.)+(spec|test).[tj]s?(x)"],
transform: {
"^.+\\.(js|ts|tsx)$": "ts-jest",
"^.+.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$":
"jest-transform-stub",
},
};
export default config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment