From b38ed786cd87fc5310bdd3f632a9157180e66c21 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 14 Jul 2023 15:57:37 +0300 Subject: [PATCH 1/4] test: do not use test patterns in sharding tests --- test/parallel/test-runner-cli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index c7fb6a0276aeb8..5546ef9dff2d37 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -272,7 +272,7 @@ const testFixtures = fixtures.path('test-runner'); const args = [ '--test', '--test-shard=1/2', - join(testFixtures, 'shards/*.cjs'), + fixtures.path(testFixtures, 'shards'), ]; const child = spawnSync(process.execPath, args); @@ -306,7 +306,7 @@ const testFixtures = fixtures.path('test-runner'); const args = [ '--test', '--test-shard=2/2', - join(testFixtures, 'shards/*.cjs'), + fixtures.path(testFixtures, 'shards') ]; const child = spawnSync(process.execPath, args); From b39ccb6fae2b5bc00322260a346e2d3d65225328 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:03:44 +0300 Subject: [PATCH 2/4] format --- test/parallel/test-runner-cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index 5546ef9dff2d37..cfc952de8e151c 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -306,7 +306,7 @@ const testFixtures = fixtures.path('test-runner'); const args = [ '--test', '--test-shard=2/2', - fixtures.path(testFixtures, 'shards') + fixtures.path(testFixtures, 'shards'), ]; const child = spawnSync(process.execPath, args); From a299a1aeb78fd4cb8f06fa983c7f7b47b24ec7db Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:23:46 +0300 Subject: [PATCH 3/4] fix tests --- test/parallel/test-runner-cli.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index cfc952de8e151c..234445365898d4 100644 --- a/test/parallel/test-runner-cli.js +++ b/test/parallel/test-runner-cli.js @@ -269,10 +269,22 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, first shard + const allShardsTestsFiles = [ + 'a.cjs', + 'b.cjs', + 'c.cjs', + 'd.cjs', + 'e.cjs', + 'f.cjs', + 'g.cjs', + 'h.cjs', + 'i.cjs', + 'j.cjs', + ].map((file) => join(testFixtures, 'shards', file)); const args = [ '--test', '--test-shard=1/2', - fixtures.path(testFixtures, 'shards'), + ...allShardsTestsFiles, ]; const child = spawnSync(process.execPath, args); @@ -303,10 +315,22 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, last shard + const allShardsTestsFiles = [ + 'a.cjs', + 'b.cjs', + 'c.cjs', + 'd.cjs', + 'e.cjs', + 'f.cjs', + 'g.cjs', + 'h.cjs', + 'i.cjs', + 'j.cjs', + ].map((file) => join(testFixtures, 'shards', file)); const args = [ '--test', '--test-shard=2/2', - fixtures.path(testFixtures, 'shards'), + ...allShardsTestsFiles, ]; const child = spawnSync(process.execPath, args); From e7a5b7ce115337b9a47ad2e0a62bbeee95cffd79 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Fri, 14 Jul 2023 18:54:56 +0300 Subject: [PATCH 4/4] get test files dynamically --- test/parallel/test-runner-cli.js | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-runner-cli.js b/test/parallel/test-runner-cli.js index 234445365898d4..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,18 +270,8 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, first shard - const allShardsTestsFiles = [ - 'a.cjs', - 'b.cjs', - 'c.cjs', - 'd.cjs', - 'e.cjs', - 'f.cjs', - 'g.cjs', - 'h.cjs', - 'i.cjs', - 'j.cjs', - ].map((file) => join(testFixtures, 'shards', file)); + const shardsTestPath = join(testFixtures, 'shards'); + const allShardsTestsFiles = readdirSync(shardsTestPath).map((file) => join(shardsTestPath, file)); const args = [ '--test', '--test-shard=1/2', @@ -315,18 +306,8 @@ const testFixtures = fixtures.path('test-runner'); { // --test-shard option, last shard - const allShardsTestsFiles = [ - 'a.cjs', - 'b.cjs', - 'c.cjs', - 'd.cjs', - 'e.cjs', - 'f.cjs', - 'g.cjs', - 'h.cjs', - 'i.cjs', - 'j.cjs', - ].map((file) => join(testFixtures, 'shards', file)); + const shardsTestPath = join(testFixtures, 'shards'); + const allShardsTestsFiles = readdirSync(shardsTestPath).map((file) => join(shardsTestPath, file)); const args = [ '--test', '--test-shard=2/2',