diff --git a/frontend/jest.config.cjs b/frontend/jest.config.cjs index 190e420..6896a3a 100644 --- a/frontend/jest.config.cjs +++ b/frontend/jest.config.cjs @@ -7,6 +7,12 @@ module.exports = { '\\.scss$': '/__mocks__/styleMock.js', }, transform: { - '^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: { esModuleInterop: true } }], + // ts-jest compiles each file with its own program and drops the automatic `@types/*` + // inclusion, so whichever suite jest compiles first fails with "Cannot find name + // 'jest'". Declaring the test globals here makes every suite compile in any order. + '^.+\\.(ts|tsx)$': [ + 'ts-jest', + { tsconfig: { esModuleInterop: true, types: ['jest', '@testing-library/jest-dom'] } }, + ], }, };