-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathjest.config.base.js
More file actions
29 lines (27 loc) · 888 Bytes
/
jest.config.base.js
File metadata and controls
29 lines (27 loc) · 888 Bytes
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
const { resolve } = require('path');
const { pathsToModuleNameMapper } = require('ts-jest');
const ROOT_DIR = __dirname;
const TSCONFIG_PATH = resolve(ROOT_DIR, 'tsconfig.json');
const tsconfig = require(TSCONFIG_PATH);
const CI = !!process.env.CI;
module.exports = (dir) => {
return {
testEnvironment: 'node',
rootDir: dir,
reporters: ['default'],
modulePathIgnorePatterns: ['dist', '.bob'],
moduleNameMapper: {
...pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: `${ROOT_DIR}/`,
}),
// node
'^#async\\-context$': `${ROOT_DIR}/packages/graphql-modules/src/async-context.node.cjs`,
// browser
// '^#async\\-context$': `${ROOT_DIR}/packages/graphql-modules/src/async-context.browser.mjs`,
},
cacheDirectory: resolve(
ROOT_DIR,
`${CI ? '' : 'node_modules/'}.cache/jest`
),
};
};