forked from ardatan/graphql-mesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
44 lines (38 loc) · 1.36 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
const { resolve } = require('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 = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
if (process.env.LEAK_TEST) {
testMatch.push('!**/examples/grpc-*/**');
testMatch.push('!**/examples/sqlite-*/**');
testMatch.push('!**/examples/mysql-*/**');
}
testMatch.push(process.env.INTEGRATION_TEST ? '!**/packages/**' : '!**/examples/**');
module.exports = {
testEnvironment: 'node',
rootDir: ROOT_DIR,
restoreMocks: true,
reporters: ['default'],
modulePathIgnorePatterns: ['dist', 'fixtures', '.bob'],
moduleNameMapper: {
'@graphql-mesh/cross-helpers': '<rootDir>/packages/cross-helpers/node.js',
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: `${ROOT_DIR}/`,
}),
'formdata-node': '<rootDir>/node_modules/formdata-node/lib/cjs/index.js',
},
collectCoverage: false,
cacheDirectory: resolve(ROOT_DIR, `${CI ? '' : 'node_modules/'}.cache/jest`),
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.mjs?$': 'babel-jest',
'^.+\\.ts?$': 'babel-jest',
'^.+\\.js$': 'babel-jest',
},
resolver: 'bob-the-bundler/jest-resolver.js',
testMatch,
};