| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import type {Config} from '@jest/types'; |
| 9 | |
| 10 | const config: Config.InitialOptions = { |
| 11 | verbose: true, |
| 12 | testRegex: '/integrationTests/.*\\.test\\.tsx?', |
| 13 | |
| 14 | // shutting down watchman is async, so our `dispose` does not synchronously tear down everything, |
| 15 | // thus jest thinks we have leaked handles. Force exits quiets this warning. |
| 16 | forceExit: true, |
| 17 | |
| 18 | // Even though the repos are separate, somehow running multiple integration tests in parallel |
| 19 | // causes failures. For now, just limit to one test at a time. |
| 20 | maxWorkers: 1, |
| 21 | |
| 22 | // use typescript in tests |
| 23 | preset: 'ts-jest', |
| 24 | testEnvironment: 'jsdom', |
| 25 | rootDir: '..', |
| 26 | setupFilesAfterEnv: ['<rootDir>/integrationTests/setupTests.ts'], |
| 27 | testTimeout: 120_000, |
| 28 | |
| 29 | modulePaths: ['<rootDir>/src'], |
| 30 | moduleNameMapper: { |
| 31 | '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': |
| 32 | '<rootDir>/src/__mocks__/fileMock.js', |
| 33 | '\\.css$': '<rootDir>/src/__mocks__/styleMock.ts', |
| 34 | }, |
| 35 | transform: { |
| 36 | '^.+\\.tsx?$': '<rootDir>/jest-transformer-import-meta.cjs', |
| 37 | }, |
| 38 | transformIgnorePatterns: [ |
| 39 | '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$', |
| 40 | '^.+\\.module\\.(css|sass|scss)$', |
| 41 | ], |
| 42 | }; |
| 43 | export default config; |
| 44 | |