fix(test): use mockReturnValueOnce for pwsh shell mock to prevent test pollution

vi.clearAllMocks() clears call history but not mockReturnValue implementations.
The Windows pwsh shell tests were polluting subsequent tests that expected the
default sh mock. Changed to mockReturnValueOnce so the override is consumed
by the single call and subsequent tests get the default sh implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Priyanshu Choudhary 2026-04-08 20:56:23 +05:30
parent 17946940f4
commit ed9fca84d2
2 changed files with 2 additions and 2 deletions

View File

@ -644,7 +644,7 @@ describe("workspace.postCreate()", () => {
const project = makeProject({ postCreate: ["npm install"] });
mockGetShell.mockReturnValue({
mockGetShell.mockReturnValueOnce({
cmd: "pwsh",
args: (c: string) => ["-NoLogo", "-NonInteractive", "-Command", c],
});

View File

@ -885,7 +885,7 @@ describe("workspace.postCreate()", () => {
const ws = create();
const project = makeProject({ postCreate: ["npm install"] });
mockGetShell.mockReturnValue({
mockGetShell.mockReturnValueOnce({
cmd: "pwsh",
args: (c: string) => ["-NoLogo", "-NonInteractive", "-Command", c],
});