From 33b9bdb11e9371dfa6891ba1be47a12b958f493d Mon Sep 17 00:00:00 2001 From: Abhi <43648792+abhipatel12@users.noreply.github.com> Date: Sun, 17 Aug 2025 00:02:54 -0400 Subject: feat(cli): Introduce arguments for shell execution in custom commands (#5966) --- .../core/src/services/shellExecutionService.test.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'packages/core/src/services') diff --git a/packages/core/src/services/shellExecutionService.test.ts b/packages/core/src/services/shellExecutionService.test.ts index 2fe51a5e..47df12e8 100644 --- a/packages/core/src/services/shellExecutionService.test.ts +++ b/packages/core/src/services/shellExecutionService.test.ts @@ -10,6 +10,16 @@ vi.mock('child_process', () => ({ spawn: mockSpawn, })); +const mockGetShellConfiguration = vi.hoisted(() => vi.fn()); +let mockIsWindows = false; + +vi.mock('../utils/shell-utils.js', () => ({ + getShellConfiguration: mockGetShellConfiguration, + get isWindows() { + return mockIsWindows; + }, +})); + import EventEmitter from 'events'; import { Readable } from 'stream'; import { type ChildProcess } from 'child_process'; @@ -43,18 +53,21 @@ describe('ShellExecutionService', () => { vi.clearAllMocks(); mockIsBinary.mockReturnValue(false); - mockPlatform.mockReturnValue('linux'); + + mockGetShellConfiguration.mockReturnValue({ + executable: 'bash', + argsPrefix: ['-c'], + }); + mockIsWindows = false; onOutputEventMock = vi.fn(); mockChildProcess = new EventEmitter() as EventEmitter & Partial; - // FIX: Cast simple EventEmitters to the expected stream type. mockChildProcess.stdout = new EventEmitter() as Readable; mockChildProcess.stderr = new EventEmitter() as Readable; mockChildProcess.kill = vi.fn(); - // FIX: Use Object.defineProperty to set the readonly 'pid' property. Object.defineProperty(mockChildProcess, 'pid', { value: 12345, configurable: true, -- cgit v1.2.3