-
Notifications
You must be signed in to change notification settings - Fork 166
/
jest.config.js
47 lines (45 loc) · 1.51 KB
/
jest.config.js
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
'use strict';
const path = require('path');
/**
* @type {import('jest').Config}
*/
module.exports = {
rootDir: __dirname,
testMatch: ['/**/(*.)+(spec|test).[jt]s?(x)'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
globalSetup: '<rootDir>/test/global-setup.js',
setupFilesAfterEnv: ['@testing-library/jest-dom', '<rootDir>/test/env-setup.js'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
'^@strapi/design-system$': '<rootDir>/packages/design-system/src',
'^@strapi/ui-primitives$': '<rootDir>/packages/primitives/src',
'^@strapi/icons$': '<rootDir>/packages/icons/src',
'^react$': path.join(__dirname, 'node_modules/react'),
'^react-dom$': path.join(__dirname, 'node_modules/react-dom'),
'^react-router-dom$': path.join(__dirname, 'node_modules/react-router-dom'),
'^styled-components$': path.join(__dirname, 'node_modules/styled-components'),
},
testEnvironment: 'jsdom',
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
},
],
},
prettierPath: require.resolve('prettier-2'),
watchPlugins: [
require.resolve('jest-watch-select-projects'),
require.resolve('jest-watch-typeahead/filename'),
require.resolve('jest-watch-typeahead/testname'),
],
};