fix(pwsh): accept link-shaped candidates and sync the README contract

This commit is contained in:
Huanqi Cao
2026-08-12 15:11:20 +08:00
committed by Chinesezjc
parent 7593842ccf
commit 29d420f1ee
5 changed files with 28 additions and 11 deletions
@@ -138,6 +138,17 @@ describe('resolvePwshPath and candidatePwshPaths (pure, every platform)', () =>
expect(resolvePwshPath(undefined, { ProgramFiles: join(dir, 'missing'), PATH: store }, 'win32'))
.toBe(link)
})
it('skips a directory candidate and falls through to the PATH-resolution default', () => {
const dir = mkdtempSync(join(tmpdir(), 'dsh-pwsh-resolve-dir-'))
const store = join(dir, 'store')
mkdirSync(join(store, 'pwsh.exe'), { recursive: true })
expect(resolvePwshPath(undefined, {
ProgramFiles: join(dir, 'missing'),
PATH: store,
SystemRoot: join(dir, 'no-windows'),
}, 'win32')).toBe('pwsh')
})
})
describe('spawn construction (pure, every platform)', () => {