forked from prisma/prisma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
46 lines (41 loc) · 1.26 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
'use strict'
const isMacOrWindowsCI = Boolean(process.env.CI) && ['darwin', 'win32'].includes(process.platform)
module.exports = () => {
// Default
let testTimeout = 30_000
if (isMacOrWindowsCI) {
testTimeout = 100_000
}
const configCommon = {
testMatch: ['**/*.ts', '!(**/*.d.ts)', '!(**/_utils/**)', '!(**/_*.ts)', '!(**/.generated/**)'],
transformIgnorePatterns: [],
reporters: ['default'],
globalSetup: './_utils/globalSetup.js',
snapshotSerializers: ['@prisma/get-platform/src/test-utils/jestSnapshotSerializer'],
setupFilesAfterEnv: ['./_utils/setupFilesAfterEnv.ts'],
testTimeout,
collectCoverage: process.env.CI ? true : false,
}
if (process.env['JEST_JUNIT_DISABLE'] !== 'true') {
configCommon.reporters.push([
'jest-junit',
{
addFileAttribute: 'true',
ancestorSeparator: ' › ',
classNameTemplate: (vars) => {
return vars.classname
.replace(/(\(.*)provider=\w+,? ?(.*\))/, '$1$2')
.replace(/(\(.*)providerFlavor=\w+,? ?(.*\))/, '$1$2')
.replace(' ()', '')
},
titleTemplate: '{title}',
},
])
}
return {
...configCommon,
transform: {
'^.+\\.(m?j|t)s$': ['./esbuild-transformer', {}],
},
}
}