fix(core): Use shell for spawn on Windows (#9995)

This commit is contained in:
Gal Zahavi
2025-10-08 14:21:23 -07:00
committed by GitHub
parent 8d8a2ab64e
commit 741b57ed06
6 changed files with 41 additions and 9 deletions

View File

@@ -32,13 +32,25 @@ class MockProcessExitError extends Error {
}
// Mock dependencies
vi.mock('./config/settings.js', async (importOriginal) => {
const actual = await importOriginal<typeof import('./config/settings.js')>();
return {
...actual,
loadSettings: vi.fn(),
};
});
vi.mock('./config/settings.js', () => ({
loadSettings: vi.fn().mockReturnValue({
merged: {
advanced: {},
security: { auth: {} },
ui: {},
},
setValue: vi.fn(),
forScope: () => ({ settings: {}, originalSettings: {}, path: '' }),
errors: [],
}),
migrateDeprecatedSettings: vi.fn(),
SettingScope: {
User: 'user',
Workspace: 'workspace',
System: 'system',
SystemDefaults: 'system-defaults',
},
}));
vi.mock('./config/config.js', () => ({
loadCliConfig: vi.fn().mockResolvedValue({

View File

@@ -31,6 +31,7 @@ describe('validateNonInterActiveAuth', () => {
processExitSpy = vi.spyOn(process, 'exit').mockImplementation((code) => {
throw new Error(`process.exit(${code}) called`);
});
vi.spyOn(auth, 'validateAuthMethod').mockReturnValue(null);
refreshAuthMock = vi.fn().mockResolvedValue('refreshed');
mockSettings = {
system: { path: '', settings: {} },