mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
fix: libs test
This commit is contained in:
@@ -20,6 +20,7 @@ async function collectAsyncGenerator<T>(generator: AsyncGenerator<T>): Promise<T
|
|||||||
describe('subprocess.ts', () => {
|
describe('subprocess.ts', () => {
|
||||||
let consoleSpy: {
|
let consoleSpy: {
|
||||||
log: ReturnType<typeof vi.spyOn>;
|
log: ReturnType<typeof vi.spyOn>;
|
||||||
|
warn: ReturnType<typeof vi.spyOn>;
|
||||||
error: ReturnType<typeof vi.spyOn>;
|
error: ReturnType<typeof vi.spyOn>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -27,12 +28,14 @@ describe('subprocess.ts', () => {
|
|||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
consoleSpy = {
|
consoleSpy = {
|
||||||
log: vi.spyOn(console, 'log').mockImplementation(() => {}),
|
log: vi.spyOn(console, 'log').mockImplementation(() => {}),
|
||||||
|
warn: vi.spyOn(console, 'warn').mockImplementation(() => {}),
|
||||||
error: vi.spyOn(console, 'error').mockImplementation(() => {}),
|
error: vi.spyOn(console, 'error').mockImplementation(() => {}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
consoleSpy.log.mockRestore();
|
consoleSpy.log.mockRestore();
|
||||||
|
consoleSpy.warn.mockRestore();
|
||||||
consoleSpy.error.mockRestore();
|
consoleSpy.error.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -176,11 +179,11 @@ describe('subprocess.ts', () => {
|
|||||||
const generator = spawnJSONLProcess(baseOptions);
|
const generator = spawnJSONLProcess(baseOptions);
|
||||||
await collectAsyncGenerator(generator);
|
await collectAsyncGenerator(generator);
|
||||||
|
|
||||||
expect(consoleSpy.error).toHaveBeenCalledWith(
|
expect(consoleSpy.warn).toHaveBeenCalledWith(
|
||||||
expect.stringContaining('Warning: something happened')
|
expect.stringContaining('[SubprocessManager] stderr: Warning: something happened')
|
||||||
);
|
);
|
||||||
expect(consoleSpy.error).toHaveBeenCalledWith(
|
expect(consoleSpy.warn).toHaveBeenCalledWith(
|
||||||
expect.stringContaining('Error: critical issue')
|
expect.stringContaining('[SubprocessManager] stderr: Error: critical issue')
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user