diff --git a/test/parallel/test-cluster-concurrent-disconnect.js b/test/parallel/test-cluster-concurrent-disconnect.js index e3771a0a4fd..c2ba7b43447 100644 --- a/test/parallel/test-cluster-concurrent-disconnect.js +++ b/test/parallel/test-cluster-concurrent-disconnect.js @@ -10,7 +10,7 @@ const os = require('os'); if (cluster.isPrimary) { const workers = []; - const numCPUs = os.cpus().length; + const numCPUs = os.availableParallelism(); let waitOnline = numCPUs; for (let i = 0; i < numCPUs; i++) { const worker = cluster.fork(); diff --git a/test/parallel/test-gc-http-client-connaborted.js b/test/parallel/test-gc-http-client-connaborted.js index fd276d30e2b..e9282653f2c 100644 --- a/test/parallel/test-gc-http-client-connaborted.js +++ b/test/parallel/test-gc-http-client-connaborted.js @@ -8,7 +8,7 @@ const onGC = require('../common/ongc'); const http = require('http'); const os = require('os'); -const cpus = os.cpus().length; +const cpus = os.availableParallelism(); let createClients = true; let done = 0; let count = 0; diff --git a/test/parallel/test-gc-net-timeout.js b/test/parallel/test-gc-net-timeout.js index 6b9d51c98d0..dfb2bbfd92a 100644 --- a/test/parallel/test-gc-net-timeout.js +++ b/test/parallel/test-gc-net-timeout.js @@ -26,7 +26,7 @@ function serverHandler(sock) { }, 100); } -const cpus = os.cpus().length; +const cpus = os.availableParallelism(); let createClients = true; let done = 0; let count = 0; diff --git a/test/parallel/test-worker-memory.js b/test/parallel/test-worker-memory.js index 19b89d4321d..8c38409a26b 100644 --- a/test/parallel/test-worker-memory.js +++ b/test/parallel/test-worker-memory.js @@ -7,7 +7,7 @@ const assert = require('assert'); const util = require('util'); const { Worker } = require('worker_threads'); -let numWorkers = +process.env.JOBS || require('os').cpus().length; +let numWorkers = +process.env.JOBS || require('os').availableParallelism(); 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 diff --git a/test/pummel/test-policy-integrity-dep.js b/test/pummel/test-policy-integrity-dep.js index 02f24d02a23..cbccc60cdb4 100644 --- a/test/pummel/test-policy-integrity-dep.js +++ b/test/pummel/test-policy-integrity-dep.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-parent-commonjs.js b/test/pummel/test-policy-integrity-parent-commonjs.js index 425abe38ebd..2e77786e3b9 100644 --- a/test/pummel/test-policy-integrity-parent-commonjs.js +++ b/test/pummel/test-policy-integrity-parent-commonjs.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-parent-module.js b/test/pummel/test-policy-integrity-parent-module.js index dda800dc365..1c1c8cbbb47 100644 --- a/test/pummel/test-policy-integrity-parent-module.js +++ b/test/pummel/test-policy-integrity-parent-module.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-parent-no-package-json.js b/test/pummel/test-policy-integrity-parent-no-package-json.js index a722263e1e4..012b2228d3e 100644 --- a/test/pummel/test-policy-integrity-parent-no-package-json.js +++ b/test/pummel/test-policy-integrity-parent-no-package-json.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-worker-commonjs.js b/test/pummel/test-policy-integrity-worker-commonjs.js index b5d49222a2f..bfa24cd8fd4 100644 --- a/test/pummel/test-policy-integrity-worker-commonjs.js +++ b/test/pummel/test-policy-integrity-worker-commonjs.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-worker-module.js b/test/pummel/test-policy-integrity-worker-module.js index a8a4fb2c295..e51e24be458 100644 --- a/test/pummel/test-policy-integrity-worker-module.js +++ b/test/pummel/test-policy-integrity-worker-module.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/pummel/test-policy-integrity-worker-no-package-json.js b/test/pummel/test-policy-integrity-worker-no-package-json.js index e5b3e3ccfab..c1cfa22eb69 100644 --- a/test/pummel/test-policy-integrity-worker-no-package-json.js +++ b/test/pummel/test-policy-integrity-worker-no-package-json.js @@ -22,7 +22,7 @@ const fs = require('fs'); const path = require('path'); const { pathToFileURL } = require('url'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function hash(algo, body) { const values = []; diff --git a/test/sequential/test-gc-http-client-onerror.js b/test/sequential/test-gc-http-client-onerror.js index d5ae7fbd20c..7574c0f9373 100644 --- a/test/sequential/test-gc-http-client-onerror.js +++ b/test/sequential/test-gc-http-client-onerror.js @@ -6,7 +6,7 @@ const common = require('../common'); const onGC = require('../common/ongc'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function serverHandler(req, res) { req.resume(); diff --git a/test/sequential/test-gc-http-client-timeout.js b/test/sequential/test-gc-http-client-timeout.js index 3472e79422d..51dec7f0431 100644 --- a/test/sequential/test-gc-http-client-timeout.js +++ b/test/sequential/test-gc-http-client-timeout.js @@ -16,7 +16,7 @@ function serverHandler(req, res) { }, 100); } -const cpus = os.cpus().length; +const cpus = os.availableParallelism(); const numRequests = 36; let createClients = true; let done = 0; diff --git a/test/sequential/test-gc-http-client.js b/test/sequential/test-gc-http-client.js index 34f565c315d..8e9d3e9e729 100644 --- a/test/sequential/test-gc-http-client.js +++ b/test/sequential/test-gc-http-client.js @@ -5,7 +5,7 @@ const common = require('../common'); const onGC = require('../common/ongc'); -const cpus = require('os').cpus().length; +const cpus = require('os').availableParallelism(); function serverHandler(req, res) { res.writeHead(200, { 'Content-Type': 'text/plain' });