From f14099e628b324e520ca5423cea82be6648419d4 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Tue, 19 Dec 2023 01:40:14 +0000 Subject: [PATCH] Dev: Run tests on all CPU cores on CI --- jest.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jest.config.js b/jest.config.js index 6966b1e..8182132 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,5 +11,8 @@ module.exports = { testEnvironment: 'node', coverageDirectory: 'coverage', collectCoverageFrom: ['index.js', 'lib/**/*.js'], - setupFilesAfterEnv: ['jest-extended/all'] + setupFilesAfterEnv: ['jest-extended/all'], + // Jest by default uses a number of workers equal to number of CPU cores minus 1. + // Github Actions runners provide 2 cores and running with 2 workers is faster than 1. + ...(process.env.CI && {maxWorkers: '100%'}) };