Skip to content

Commit 38ec649

Browse files
committed
test(daemon-client): avoid spawning an untracked contender
1 parent 1edaf2e commit 38ec649

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎packages/daemon-client/src/__tests__/daemon-client-startup-race.test.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -395,21 +395,21 @@ test('a busy contender that exits sweeps its own pre-lock marker before the retr
395395
if (claim.status !== 'acquired') throw new Error('fixture claim refused');
396396
let released = false;
397397
spawn.mockImplementation((_command, _args, options) => {
398+
if (spawn.mock.calls.length !== 1) {
399+
throw new Error('no second launch: the retry boundary must be observable without a sweeper');
400+
}
398401
const child = spawnRegisteredDaemonFixture(paths, fields(http.port), options, undefined, {
399402
emitStartupMarkerBeforeAcquisition: true,
400403
});
401-
if (spawn.mock.calls.length === 1) {
402-
void child.exited.then((exit) => {
403-
assert.equal(exit.exitCode, DAEMON_STARTUP_EXIT_CODES.busy);
404-
if (!released) {
405-
void claim.acquisition.release().then(() => {
406-
released = true;
407-
});
408-
}
409-
});
410-
return child;
411-
}
412-
throw new Error('no second launch: the retry boundary must be observable without a sweeper');
404+
void child.exited.then((exit) => {
405+
assert.equal(exit.exitCode, DAEMON_STARTUP_EXIT_CODES.busy);
406+
if (!released) {
407+
void claim.acquisition.release().then(() => {
408+
released = true;
409+
});
410+
}
411+
});
412+
return child;
413413
});
414414
pause.mockImplementation((ms) => actualRetry.sleep(Math.min(Number(ms), 50)));
415415
try {

0 commit comments

Comments
 (0)