-
Notifications
You must be signed in to change notification settings - Fork 575
/
jest.config.js
61 lines (53 loc) · 1.75 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
/* eslint-disable @typescript-eslint/no-var-requires */
const { resolve } = require('node:path');
const { pathsToModuleNameMapper } = require('ts-jest');
const CI = !!process.env.CI;
const ROOT_DIR = __dirname;
const TSCONFIG = resolve(ROOT_DIR, 'tsconfig.json');
const tsconfig = require(TSCONFIG);
process.env.LC_ALL = 'en_US';
const testMatch = [];
let testTimeout = undefined;
if (process.env.INTEGRATION_TEST === 'true') {
testTimeout = 10_000;
testMatch.push('<rootDir>/**/__integration-tests__/**/?(*.)+(spec|test).[jt]s?(x)');
if (parseInt(process.versions.node.split('.')[0]) <= 14) {
testMatch.push('!**/examples/sveltekit/**', '!**/examples/fastify*/**');
}
testMatch.push('!**/examples/bun*/**');
} else {
testMatch.push(
'<rootDir>/packages/**/?(*.)+(spec|test).[jt]s?(x)',
'!**/__integration-tests__/**',
);
}
// tests that leak due to external dependencies
if (process.env.LEAKS_TEST === 'true') {
testMatch.push(
'!**/hackernews.spec.ts',
'!**/apollo-link.spec.ts',
'!**/urql-exchange.spec.ts',
'!**/apollo-link.spec.ts',
'!**/uwebsockets.test.ts',
'!**/apollo-client.test.ts',
'!**/browser.spec.ts',
);
}
testMatch.push('!**/dist/**', '!**/.bob/**');
module.exports = {
testEnvironment: 'node',
rootDir: ROOT_DIR,
restoreMocks: true,
reporters: ['default'],
modulePathIgnorePatterns: ['dist'],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: `${ROOT_DIR}/`,
}),
collectCoverage: false,
cacheDirectory: resolve(ROOT_DIR, `${CI ? '' : 'node_modules/'}.cache/jest`),
testMatch,
testTimeout,
resolver: 'bob-the-bundler/jest-resolver',
// jest-snapshots don't support prettier v3 (https://github.com/jestjs/jest/issues/14305)
prettierPath: null,
};