Skip to content

Commit 227cb16

Browse files
test: fail a shard that cannot take the minify-corpora results lock
1 parent 767344e commit 227cb16

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎test/specCases/minify-corpora.js‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ const defineShard = (shard, count) => {
22032203
);
22042204
fs.renameSync(`${file}.tmp`, file);
22052205
// Shards finish moments apart, so one at a time reads, reports and cleans
2206-
// up; a holder that died frees the lock after a minute.
2206+
// up; one still waiting after a minute fails rather than hang the run.
22072207
const lockDir = `${runDir}.lock`;
22082208
const pause = new Int32Array(new SharedArrayBuffer(4));
22092209
for (let waited = 0; ; waited += 10) {
@@ -2214,7 +2214,12 @@ const defineShard = (shard, count) => {
22142214
if (/** @type {NodeJS.ErrnoException} */ (err).code !== "EEXIST") {
22152215
throw err;
22162216
}
2217-
if (waited >= 60000) break;
2217+
if (waited >= 60000) {
2218+
throw new Error(
2219+
`${lockDir} was held for a minute: remove it if no jest run is using it`,
2220+
{ cause: err }
2221+
);
2222+
}
22182223
Atomics.wait(pause, 0, 0, 10);
22192224
}
22202225
}

0 commit comments

Comments
 (0)