-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
93 lines (87 loc) · 2.22 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// eslint-disable-next-line @typescript-eslint/no-var-requires -- can't use import here
const dotenv = require('dotenv');
// Load environment variables from .env file at the root of the repository
dotenv.config({ path: `${__dirname}/.env` });
const transform = {
'^.+\\.tsx?$': [
'ts-jest',
{
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
dynamicImport: true,
},
},
},
],
};
const setupFilesAfterEnv = [`<rootDir>/jest.setup.js`];
/*
When running in CI (GitHub Actions), use the GitHub Actions reporter to annotate the PR with any test failures.
Locally, use the default reporter.
See:
- https://jestjs.io/docs/configuration#github-actions-reporter
- https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
*/
const reporters = process.env.GITHUB_ACTIONS
? [['github-actions', { silent: false }], 'summary']
: ['default'];
module.exports = {
verbose: true,
testEnvironment: 'node',
reporters,
projects: [
{
displayName: 'cdk',
transform,
transformIgnorePatterns: [
'node_modules/(?!@guardian/private-infrastructure-config)',
],
setupFilesAfterEnv: [`<rootDir>/packages/cdk/jest.setup.js`],
testMatch: ['<rootDir>/packages/cdk/**/*.test.ts'],
},
{
displayName: 'cloudbuster',
transform,
setupFilesAfterEnv,
testMatch: ['<rootDir>/packages/cloudbuster/**/*.test.ts'],
},
{
displayName: 'common',
transform,
setupFilesAfterEnv,
testMatch: ['<rootDir>/packages/common/**/*.test.ts'],
},
{
displayName: 'dependency-graph-integrator',
transform,
setupFilesAfterEnv,
testMatch: [
'<rootDir>/packages/dependency-graph-integrator/**/*.test.ts',
],
},
{
displayName: 'repocop',
transform,
setupFilesAfterEnv,
transformIgnorePatterns: [
'node_modules/(?!@guardian/private-infrastructure-config)',
],
testMatch: ['<rootDir>/packages/repocop/**/*.test.ts'],
},
{
displayName: 'interactive-monitor',
transform,
setupFilesAfterEnv,
testMatch: ['<rootDir>/packages/interactive-monitor/**/*.test.ts'],
},
{
displayName: 'obligatron',
transform,
setupFilesAfterEnv,
testMatch: ['<rootDir>/packages/obligatron/**/*.test.ts'],
},
],
};