diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js index 56b06858ddd93f..db204244a533d7 100644 --- a/test/parallel/test-worker-memory.js +++ b/test/parallel/test-worker-memory.js @@ -4,7 +4,13 @@ const assert = require('assert'); const util = require('util'); const { Worker } = require('worker_threads'); -const numWorkers = +process.env.JOBS || require('os').cpus().length; +let numWorkers = +process.env.JOBS || require('os').cpus().length; +if (numWorkers > 20) { + // Cap the number of workers at 20 (as an even divisor of 60 used as + // the total number of workers started) otherwise the test fails on + // machines with high core counts. + numWorkers = 20; +} // Verify that a Worker's memory isn't kept in memory after the thread finishes.