-
Notifications
You must be signed in to change notification settings - Fork 530
/
Copy pathjest.config.js
83 lines (80 loc) · 2.47 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
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
73
74
75
76
77
78
79
80
81
82
83
// @ts-check
/** @type {any} */
const packagejson = require('./package.json');
/** @type {'3' | '4' | '5'} */
const algoliaSearchMajor =
packagejson.devDependencies.algoliasearch.split('.')[0];
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
rootDir: process.cwd(),
testRunner: 'jest-circus',
testEnvironment: 'node',
setupFilesAfterEnv: ['./tests/utils/setupTests.ts'],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/packages/*/node_modules/',
'<rootDir>/packages/*/dist*',
'<rootDir>/tests/e2e/*',
'<rootDir>/examples/',
'<rootDir>/packages/algoliasearch-helper',
'<rootDir>/packages/create-instantsearch-app',
'<rootDir>/packages/react-instantsearch-router-nextjs/__tests__',
'<rootDir>/packages/react-instantsearch-nextjs/__tests__',
'/__utils__/',
algoliaSearchMajor !== '5' && '<rootDir>/packages/algolia-experiences',
].filter((x) => x !== false),
watchPathIgnorePatterns: [
'<rootDir>/packages/*/cjs',
'<rootDir>/packages/*/dist',
'<rootDir>/packages/*/es',
'<rootDir>/packages/*/stories',
'<rootDir>/examples',
'<rootDir>/website',
],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
transformIgnorePatterns: [
'node_modules/(?!(search-insights|algoliasearch)/)',
],
transform: {
'^.+\\.(j|t)sx?$': 'babel-jest',
'^.+\\.vue$': '@vue/vue2-jest',
},
moduleFileExtensions: ['tsx', 'ts', 'js', 'vue'],
moduleNameMapper: {
'^react-instantsearch$': '<rootDir>/packages/react-instantsearch/src/',
'^react-instantsearch-(.*[^v6])$':
'<rootDir>/packages/react-instantsearch-$1/src/',
'^instantsearch.js$': '<rootDir>/packages/instantsearch.js/src/',
'^instantsearch.js/es(.*)$': '<rootDir>/packages/instantsearch.js/src$1',
'^instantsearch.js/(.*)$': '<rootDir>/packages/instantsearch.js/$1',
'^instantsearch-ui-components/(.*)$':
'<rootDir>/packages/instantsearch-ui-components/$1',
},
modulePathIgnorePatterns: [
'<rootDir>/packages/create-instantsearch-app/src/templates',
],
globals: {
__DEV__: true,
'ts-jest': {},
},
snapshotFormat: {
printBasicPrototype: false,
},
// reporter for circleci
reporters: [
'default',
[
'jest-junit',
{
outputDirectory: 'junit/jest',
suiteNameTemplate: '{filepath}',
ancestorSeparator: ' › ',
addFileAttribute: 'true',
},
],
],
};
module.exports = config;