-
Notifications
You must be signed in to change notification settings - Fork 129
/
jest.config.js
38 lines (36 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
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);
/** @type {import('jest').Config} */
module.exports = {
testEnvironment: 'node',
rootDir: ROOT_DIR,
projects: [
{
displayName: 'Standard Tests',
testMatch: [
'<rootDir>/**/*.spec.ts',
'<rootDir>/**/*.spec.js',
'<rootDir>/**/*.test.ts',
'<rootDir>/**/*.test.js',
],
testPathIgnorePatterns: ['<rootDir>/packages/plugins/response-cache-cloudflare-kv'],
restoreMocks: true,
modulePathIgnorePatterns: ['dist', 'test-assets', 'test-files', 'fixtures', '.bob'],
moduleNameMapper: pathsToModuleNameMapper(tsconfig.compilerOptions.paths, {
prefix: `${ROOT_DIR}/`,
}),
cacheDirectory: resolve(ROOT_DIR, `${CI ? '' : 'node_modules/'}.cache/jest`),
resolver: 'bob-the-bundler/jest-resolver',
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
},
// Cloudflare plugin tests need very different build settings
// giving Jest a string as project name will make it rely on jest.config files in the package subfolder
'<rootDir>/packages/plugins/response-cache-cloudflare-kv',
],
reporters: ['default'],
collectCoverage: false,
};