Skip to content

Commit 37841d9

Browse files
alan-agius4dgp1130
authored andcommitted
ci: filter yarn and npm tests during E2E test setup
This is a trick to force tests that take longer to run to run on different shards when using different package managers.
1 parent b8bf3b4 commit 37841d9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/legacy-cli/e2e_runner.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,25 @@ const allTests = glob
8282
.sync(testGlob, { nodir: true, cwd: e2eRoot, ignore: argv.ignore })
8383
// Replace windows slashes.
8484
.map((name) => name.replace(/\\/g, '/'))
85-
.sort()
86-
.filter((name) => !name.endsWith('/setup.ts'));
85+
.filter((name) => {
86+
if (name.endsWith('/setup.ts')) {
87+
return false;
88+
}
89+
90+
// The below is to exclude specific tests that are not intented to run for the current package manager.
91+
// This is also important as without the trickery the tests that take the longest ex: update.ts (2.5mins)
92+
// will be executed on the same shard.
93+
const fileName = path.basename(name);
94+
if (
95+
(fileName.startsWith('yarn-') && !argv.yarn) ||
96+
(fileName.startsWith('npm-') && argv.yarn)
97+
) {
98+
return false;
99+
}
100+
101+
return true;
102+
})
103+
.sort();
87104

88105
const shardId = 'shard' in argv ? argv['shard'] : null;
89106
const nbShards = (shardId === null ? 1 : argv['nb-shards']) || 2;

0 commit comments

Comments
 (0)