From ff79add1d59375817a10331a35458cca3c419cfe Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Mon, 27 Nov 2023 19:38:32 +0100 Subject: test: add MSW to intercept GraphQL requests --- jest.config.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'jest.config.js') diff --git a/jest.config.js b/jest.config.js index 34f960e..f724475 100644 --- a/jest.config.js +++ b/jest.config.js @@ -15,6 +15,10 @@ const createJestConfig = nextJest({ * @type {import('jest').Config} */ const customJestConfig = { + // Needed because of mswServer export in tests directory. + coverageProvider: 'v8', + coveragePathIgnorePatterns: ['/node_modules/', '/tests'], + // if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work moduleDirectories: ['node_modules', '/'], @@ -22,17 +26,18 @@ const customJestConfig = { '^.+\\.(svg)$': '/tests/jest/__mocks__/svgr.mock.tsx', }, + setupFiles: ['./jest.polyfills.cjs'], + // Add more setup options before each test is run setupFilesAfterEnv: ['/jest.setup.js'], // The test environment that will be used for testing testEnvironment: 'jsdom', + testEnvironmentOptions: { + customExportConditions: [''], + }, - testPathIgnorePatterns: [ - '/tests/jest/__mocks__', - '/tests/utils', - '/tests/cypress/', - ], + testPathIgnorePatterns: ['/node_modules/', '/tests'], }; /** -- cgit v1.2.3