diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index c7fb6a0276aeb8..ad1eb14732d202 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -4,6 +4,7 @@ require('../common'); const assert = require('assert'); const { spawnSync } = require('child_process'); const { join } = require('path'); +const { readdirSync } = require('fs'); const fixtures = require('../common/fixtures'); const testFixtures = fixtures.path('test-runner'); @@ -269,10 +270,12 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, first shard + const shardsTestPath = join(testFixtures, 'shards'); + const allShardsTestsFiles = readdirSync(shardsTestPath).map((file) => join(shardsTestPath, file)); const args = [ '--test', '--test-shard=1/2', - join(testFixtures, 'shards/*.cjs'), + ...allShardsTestsFiles, ]; const child = spawnSync(process.execPath, args); @@ -303,10 +306,12 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, last shard + const shardsTestPath = join(testFixtures, 'shards'); + const allShardsTestsFiles = readdirSync(shardsTestPath).map((file) => join(shardsTestPath, file)); const args = [ '--test', '--test-shard=2/2', - join(testFixtures, 'shards/*.cjs'), + ...allShardsTestsFiles, ]; const child = spawnSync(process.execPath, args);