Skip to content

Commit 3af9ed0

Browse files
committed
test(inquirer): capture prompt runner output
1 parent 4381857 commit 3af9ed0

2 files changed

Lines changed: 96 additions & 74 deletions

File tree

packages/demo/demo.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, vi } from 'vitest';
1+
import { afterEach, beforeEach, describe, it, expect, vi } from 'vitest';
22
import { screen } from '@inquirer/testing/vitest';
33

44
// Import demos AFTER @inquirer/testing/vitest to ensure mocks are applied
@@ -8,6 +8,14 @@ import selectDemo from './src/demos/select.ts';
88
import checkboxDemo from './src/demos/checkbox.ts';
99
import editorDemo from './src/demos/editor.ts';
1010

11+
beforeEach(() => {
12+
vi.spyOn(console, 'log').mockImplementation(() => {});
13+
});
14+
15+
afterEach(() => {
16+
vi.restoreAllMocks();
17+
});
18+
1119
describe('@inquirer/demo E2E tests', () => {
1220
describe('screen.getScreen()', () => {
1321
it('returns the current prompt screen', async () => {

0 commit comments

Comments
 (0)