fix: stub DSH_HOME in 'labels the default DSH home' test

The test 'labels the default DSH home as ~/.dsh when HOME points at the
configured default' mocks node:os to return a temporary home directory
and expects discoverBaselineInstructionFiles to fall back to the default
~/.dsh path. However, when DSH_HOME is externally set (e.g. in the DSH
agent environment), resolveDshHome(undefined) reads that external value
instead of falling back to defaultDshHome(), causing the test to look for
AGENTS.md in the wrong directory and return an empty result.

Stub DSH_HOME to undefined so the test controls the full resolution path.
This commit is contained in:
Huanqi Cao
2026-07-21 13:08:34 +08:00
parent 9a5c81f9e5
commit 5d6db0cd56
@@ -520,6 +520,7 @@ describe('workspace context instruction discovery', () => {
vi.resetModules()
vi.doMock('node:os', () => ({ homedir: () => home }))
vi.stubEnv('DSH_HOME', undefined)
const isolated = await import('@deepseek-ai/dsh-workspace-context')
const files = await isolated.discoverBaselineInstructionFiles({ cwd: root })
@@ -527,6 +528,7 @@ describe('workspace context instruction discovery', () => {
} finally {
vi.doUnmock('node:os')
vi.resetModules()
vi.unstubAllEnvs()
await rm(root, { recursive: true, force: true })
await rm(home, { recursive: true, force: true })
}