// jest.config.js module.exports = { testEnvironment: "node", verbose: true, coveragePathIgnorePatterns: [ "/node_modules/", "/__tests__/setup/", // Ignore setup files from coverage "/src/config/", // Often configuration files don't need testing "/config/", // logger config ], // Automatically clear mock calls and instances between every test clearMocks: true, // A path to a module which exports an async function that is triggered once before all test suites // globalSetup: './__tests__/setup/globalSetup.js', // Optional: If you need global setup // A path to a module which exports an async function that is triggered once after all test suites // globalTeardown: './__tests__/setup/globalTeardown.js', // Optional: If you need global teardown // The directory where Jest should output its coverage files coverageDirectory: "coverage", // Indicates whether the coverage information should be collected while executing the test collectCoverage: true, // An array of glob patterns indicating a set of files for which coverage information should be collected collectCoverageFrom: [ "src/**/*.js", "!server.js", // Usually the main server start file is hard to unit test directly "!src/app.js", // If you extract Express app setup to app.js for testability ], setupFilesAfterEnv: ["./__tests__/setup/jest.setup.js"], // For things like extending expect };