Skip to content

Commit ecf2647

Browse files
committed
Conditionalize Jest worker settings for CI to optimize performance.
1 parent 1dbe23d commit ecf2647

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

backend/api/jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
2828
silent: true,
2929
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
30-
// of them in parallel to exhaust memory on high-core-count machines.
31-
maxWorkers: '50%',
32-
workerIdleMemoryLimit: '512MB',
30+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
31+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
32+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
3333
}

backend/email/jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
2525
silent: true,
2626
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
27-
// of them in parallel to exhaust memory on high-core-count machines.
28-
maxWorkers: '50%',
29-
workerIdleMemoryLimit: '512MB',
27+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
28+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
29+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
3030
}

backend/shared/jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
2929
silent: true,
3030
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
31-
// of them in parallel to exhaust memory on high-core-count machines.
32-
maxWorkers: '50%',
33-
workerIdleMemoryLimit: '512MB',
31+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
32+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
33+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
3434
}

common/jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
1414
silent: true,
1515
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
16-
// of them in parallel to exhaust memory on high-core-count machines.
17-
maxWorkers: '50%',
18-
workerIdleMemoryLimit: '512MB',
16+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
17+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
18+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
1919
}

jest.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
],
2323
silent: true,
2424
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
25-
// of them in parallel to exhaust memory on high-core-count machines.
26-
maxWorkers: '50%',
27-
workerIdleMemoryLimit: '512MB',
25+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
26+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
27+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
2828
}

web/jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/**/*.d.ts'],
2525
silent: true,
2626
// Each ts-jest worker is a full TS-compiling process; the default (cpus - 1) can spawn enough
27-
// of them in parallel to exhaust memory on high-core-count machines.
28-
maxWorkers: '50%',
29-
workerIdleMemoryLimit: '512MB',
27+
// of them in parallel to exhaust memory on high-core-count machines. CI runners only have a
28+
// couple of cores, so throttling there just makes the suite slower without saving any memory.
29+
...(process.env.CI ? {} : {maxWorkers: '50%', workerIdleMemoryLimit: '512MB'}),
3030
}

0 commit comments

Comments
 (0)