mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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:
committed by
GitHub
parent
d93285dde1
commit
8201623d92
@@ -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(' '));
|
||||
|
||||
Reference in New Issue
Block a user