forked from dotansimha/graphql-code-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.project.js
31 lines (28 loc) · 1.12 KB
/
jest.project.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
const { resolve } = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies -- false positive
const { pathsToModuleNameMapper } = require('ts-jest');
const ROOT_DIR = __dirname;
const TSCONFIG = resolve(ROOT_DIR, 'tsconfig.json');
const tsconfig = require(TSCONFIG);
const CI = !!process.env.CI;
module.exports = ({ dirname, projectMode = true }) => {
const pkg = require(resolve(dirname, 'package.json'));
return {
...(CI || !projectMode ? {} : { displayName: pkg.name.replace('@graphql-codegen/', '') }),
transform: { '^.+\\.tsx?$': 'babel-jest' },
testEnvironment: 'node',
rootDir: dirname,
restoreMocks: true,
reporters: ['default'],
modulePathIgnorePatterns: ['dist', '.bob'],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: `${ROOT_DIR}/` }),
cacheDirectory: resolve(ROOT_DIR, `${CI ? '' : 'node_modules/'}.cache/jest`),
setupFiles: [`${ROOT_DIR}/dev-test/setup.js`],
collectCoverage: false,
testTimeout: 20_000,
resolver: 'bob-the-bundler/jest-resolver.js',
snapshotFormat: {
escapeString: false,
},
};
};