test: fix visibility-state-spec.ts flaky test (#44037)
* test: refactor visibility-state-spec * ci: shard tests * test: update split-tests for use on Windows * test: run visibility-state-spec.ts first
This commit is contained in:
parent
d93285dde1
commit
8201623d92
5 changed files with 74 additions and 55 deletions
|
@ -1,6 +1,9 @@
|
|||
const glob = require('glob');
|
||||
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const VISIBILITY_SPEC = 'spec\\visibility-state-spec.ts';
|
||||
|
||||
const currentShard = parseInt(process.argv[2], 10);
|
||||
const shardCount = parseInt(process.argv[3], 10);
|
||||
|
@ -25,9 +28,16 @@ specFiles.sort((a, b) => {
|
|||
|
||||
let shard = 0;
|
||||
for (const specFile of specFiles) {
|
||||
buckets[shard].push(specFile);
|
||||
buckets[shard].push(path.normalize(specFile));
|
||||
shard++;
|
||||
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(' '));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue