forked from CommunitySolidServer/CommunitySolidServer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
54 lines (47 loc) · 1.42 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
const os = require('os');
const v8 = require('v8');
// Several parts inspired by https://github.com/renovatebot/renovate/blob/main/package.json
const ci = !!process.env.CI;
const cpus = os.cpus();
const mem = os.totalmem();
const stats = v8.getHeapStatistics();
if (ci) {
process.stderr.write(`Host stats:
Cpus: ${cpus.length}
Memory: ${(mem / 1024 / 1024 / 1024).toFixed(2)} GB
HeapLimit: ${(stats.heap_size_limit / 1024 / 1024 / 1024).toFixed(2)} GB
`);
}
// See also https://github.com/jestjs/jest/issues/11956
function jestGithubRunnerSpecs() {
return {
maxWorkers: cpus.length,
workerIdleMemoryLimit: '1500MB',
};
}
module.exports = {
transform: {
'^.+\\.ts$': [ 'ts-jest', {
tsconfig: '<rootDir>/tsconfig.json',
diagnostics: false,
isolatedModules: true,
}],
},
testRegex: '/test/(unit|integration)/.*\\.test\\.ts$',
moduleFileExtensions: [
'ts',
'js',
],
testEnvironment: 'node',
globalSetup: '<rootDir>/test/util/SetupTests.ts',
setupFilesAfterEnv: [ 'jest-rdf' ],
collectCoverage: false,
// See https://github.com/matthieubosquet/ts-dpop/issues/13
moduleNameMapper: {
'^jose/(.*)$': '<rootDir>/node_modules/jose/dist/node/cjs/$1',
},
// Slower machines had problems calling the WebSocket integration callbacks on time
testTimeout: 60000,
reporters: ci ? ['default', 'github-actions'] : ['default'],
...(ci && jestGithubRunnerSpecs()),
};