test: run visibility-state-spec.ts first (#44206)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
This commit is contained in:
John Kleinschmidt 2024-10-14 09:40:22 -04:00 committed by GitHub
parent 566c72cd46
commit 48156aee06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 10 deletions

View file

@ -3,8 +3,6 @@ const glob = require('glob');
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
const VISIBILITY_SPEC = 'spec\\visibility-state-spec.ts';
const currentShard = parseInt(process.argv[2], 10); const currentShard = parseInt(process.argv[2], 10);
const shardCount = parseInt(process.argv[3], 10); const shardCount = parseInt(process.argv[3], 10);
@ -33,11 +31,4 @@ for (const specFile of specFiles) {
if (shard === shardCount) shard = 0; if (shard === shardCount) shard = 0;
} }
const visiblitySpecIdx = buckets[currentShard - 1];
if (visiblitySpecIdx > -1) {
// If visibility-state-spec is in the list, move it to the first position
// so that it gets executed first to avoid other specs interferring with it.
buckets[currentShard - 1].splice(visiblitySpecIdx, 1);
buckets[currentShard - 1].unshift(VISIBILITY_SPEC);
}
console.log(buckets[currentShard - 1].join(' ')); console.log(buckets[currentShard - 1].join(' '));

View file

@ -149,7 +149,17 @@ app.whenReady().then(async () => {
const { getFiles } = require('./get-files'); const { getFiles } = require('./get-files');
const testFiles = await getFiles(__dirname, filter); const testFiles = await getFiles(__dirname, filter);
for (const file of testFiles.sort()) { const VISIBILITY_SPEC = ('visibility-state-spec.ts');
const sortedFiles = testFiles.sort((a, b) => {
// If visibility-state-spec is in the list, move it to the first position
// so that it gets executed first to avoid other specs interferring with it.
if (a.indexOf(VISIBILITY_SPEC) > -1) {
return -1;
} else {
return a.localeCompare(b);
}
});
for (const file of sortedFiles) {
mocha.addFile(file); mocha.addFile(file);
} }