forked from adobe/react-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.ssr.config.js
72 lines (59 loc) · 2.16 KB
/
jest.ssr.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
displayName: 'SSR',
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css|styl)$': 'identity-obj-proxy'
},
resolver: '<rootDir>/lib/jestResolver.js',
// Run tests from one or more projects
projects: ['<rootDir>'],
// A list of paths to directories that Jest should use to search for files in
roots: [
'packages/'
],
testTimeout: 30000,
globalSetup: require.resolve('@react-spectrum/test-utils-internal/src/ssrSetup'),
globalTeardown: require.resolve('@react-spectrum/test-utils-internal/src/ssrTeardown'),
// The test environment that will be used for testing
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>scripts/setupTests.js'],
// The glob patterns Jest uses to detect test files
testMatch: [
'**/packages/**/*.ssr.test.[tj]s?(x)'
],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
importAssertions: true
},
transform: {
react: {
runtime: 'automatic'
}
}
}
}
]
},
};