From 8308515210a247d8982846b1d66f5d84173fb27b Mon Sep 17 00:00:00 2001 From: Steve Gravrock Date: Sun, 12 Mar 2023 15:12:26 -0700 Subject: [PATCH] Ignore the number of CPUs reported by Circle CI --- Gruntfile.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 6af4a7cb..33a7a2da 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -53,12 +53,21 @@ module.exports = function(grunt) { // so that we don't break verifyNoGlobals above by loading jasmine-core // too early const ParallelRunner = require('jasmine/parallel'); + let numWorkers = require('os').cpus().length; + + if (process.env['CIRCLECI']) { + // On Circle CI, the above gives the number of CPU cores on the host + // computer, which is unrelated to the resources actually available + // to the container. 2 workers gives peak performance with our current + // configuration, but 4 might increase the odds of discovering any + // parallel-specific bugs. + numWorkers = 4; + } - console.log('parallel runner pid:', process.pid); const done = this.async(); const runner = new ParallelRunner({ jasmineCore: require('./lib/jasmine-core.js'), - numWorkers: require('os').cpus().length + numWorkers }); runner.loadConfigFile('./spec/support/jasmine.json')