Skip to content

Commit b03b59e

Browse files
committed
fix(test): mock daemon stop through the SUT's exact specifier
The move swapped the SUT to '@agent-device/daemon/daemon-stop' while the test mocked the './testing/*' pattern alias. Vitest resolves both to one file in the unit lane, so it passed there, but the mutation lane aliases only the manifest's exact export entries (tracked-manifests), so inside the Stryker sandbox the mock specifier resolved to a phantom id, the real module loaded, and the dry run failed on zero cleanup calls. Mock the exact specifier the SUT imports; the type import follows so the pair cannot drift.
1 parent 237393f commit b03b59e

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/cli/commands/__tests__/daemon.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import fs from 'node:fs';
33
import { afterEach, expect, test, vi } from 'vitest';
4-
import type { DaemonStopResult } from '@agent-device/daemon/testing/daemon-stop';
4+
import type { DaemonStopResult } from '@agent-device/daemon/daemon-stop';
55
import { mkdtempForTestSync } from '@agent-device/test-kit/tmp-dir';
66

77
const mocks = vi.hoisted(() => ({
@@ -12,7 +12,10 @@ const mocks = vi.hoisted(() => ({
1212
writeCommandOutput: vi.fn(),
1313
}));
1414

15-
vi.mock('@agent-device/daemon/testing/daemon-stop', () => ({
15+
// The mock specifier must be the SUT's exact `@agent-device/daemon/daemon-stop`: the
16+
// mutation lane aliases only the manifest's exact entries, so the `./testing/*` pattern
17+
// form resolved outside the Stryker sandbox and the mock silently missed (#3546 CI).
18+
vi.mock('@agent-device/daemon/daemon-stop', () => ({
1619
readDaemonStopIdentity: mocks.readDaemonStopIdentity,
1720
stopDaemon: mocks.stopDaemon,
1821
}));

0 commit comments

Comments
 (0)