1.2 KB37 lines
Blame
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
8const IS_CI = !!process.env.SANDCASTLE || !!process.env.GITHUB_ACTIONS;
9
10/* global module */
11/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
12module.exports = {
13 preset: 'ts-jest',
14 testEnvironment: 'jsdom',
15 collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!src/**/*.d.ts'],
16 setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
17 testTimeout: IS_CI ? 15 * 1000 : 5 * 1000,
18 moduleNameMapper: {
19 '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
20 '<rootDir>/src/__mocks__/fileMock.js',
21 '\\.css$': '<rootDir>/src/__mocks__/styleMock.ts',
22 },
23 transformIgnorePatterns: [
24 '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
25 '^.+\\.module\\.(css|sass|scss)$',
26 ],
27 testMatch: [
28 '<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
29 '<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}',
30 ],
31 modulePaths: ['<rootDir>/src'],
32 transform: {
33 '^.+\\.tsx?$': '<rootDir>/jest-transformer-import-meta.cjs',
34 },
35 resetMocks: true,
36};
37