From ed9fca84d26cfa71eda384e5fc822829871669ee Mon Sep 17 00:00:00 2001 From: Priyanshu Choudhary <57816400+Priyanchew@users.noreply.github.com> Date: Wed, 8 Apr 2026 20:56:23 +0530 Subject: [PATCH] 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 --- packages/plugins/workspace-clone/src/__tests__/index.test.ts | 2 +- packages/plugins/workspace-worktree/src/__tests__/index.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugins/workspace-clone/src/__tests__/index.test.ts b/packages/plugins/workspace-clone/src/__tests__/index.test.ts index 956b137d9..06f339c70 100644 --- a/packages/plugins/workspace-clone/src/__tests__/index.test.ts +++ b/packages/plugins/workspace-clone/src/__tests__/index.test.ts @@ -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], }); diff --git a/packages/plugins/workspace-worktree/src/__tests__/index.test.ts b/packages/plugins/workspace-worktree/src/__tests__/index.test.ts index 42b81eaa0..fd25fb11b 100644 --- a/packages/plugins/workspace-worktree/src/__tests__/index.test.ts +++ b/packages/plugins/workspace-worktree/src/__tests__/index.test.ts @@ -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], });