Skip to content

Commit 4018289

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. (cherry picked from commit 37841d9)
1 parent 4f28c4d commit 4018289

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/legacy-cli/e2e_runner.ts

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

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

0 commit comments

Comments
 (0)