forked from mozilla/perfcompare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
51 lines (49 loc) · 1.74 KB
/
jest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import type { Config } from '@jest/types';
const config: Config.InitialOptions = {
roots: ['<rootDir>/src'],
collectCoverageFrom: ['src/**/*.{js,ts,tsx}', '!src/**/*.d.ts'],
coveragePathIgnorePatterns: ['__tests__', 'index', 'resources', 'styles'],
setupFiles: ['react-app-polyfill/jsdom'],
setupFilesAfterEnv: ['<rootDir>/src/__tests__/utils/setupTests.ts'],
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/src/__tests__/utils/'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
},
],
'^.+\\.(?:svg|png)$': '<rootDir>/src/__tests__/utils/fileTransformer.js',
},
// This transformIgnorePatterns is better understood as a double negation: the
// package names below _will_ be transformed.
// This is needed mostly because our fetch-mock doesn't use esm, but these
// dependencies of fetch-mock do! Hopefully this won't be needed in the future
// when fetch-mock updates.
transformIgnorePatterns: [
'/node_modules/(?!(taskcluster-client-web|data-uri-to-buffer|fetch-blob|formdata-polyfill|node-fetch)/)',
],
modulePaths: [],
moduleNameMapper: {
'^react-native$': 'react-native-web',
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
'\\.(css)$': 'identity-obj-proxy',
'\\.(woff|woff2|ttf)$':
'<rootDir>/src/mockData/mockedFonts/Metropolis-Bold.woff2',
},
moduleFileExtensions: ['js', 'ts', 'tsx', 'jsx'],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
globalSetup: '<rootDir>/src/__tests__/utils/globalSetup.ts',
testTimeout: 30000,
};
export default config;