Skip to content

Commit 899312f

Browse files
committed
fix: flaky test
1 parent 5b427f1 commit 899312f

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export async function runp<const TCommands extends Commands = Commands>(
112112
const results = await Promise.all(tasks.map((task) => task.result));
113113
await new Promise<void>((resolve) => setTimeout(resolve));
114114
stop?.();
115+
await new Promise<void>((resolve) => setTimeout(resolve));
115116
return results as { [K in keyof TCommands]: RunpResult };
116117
}
117118

test/subCommands.test.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { expect, test } from 'vitest';
1+
import { test } from 'vitest';
22
import { runp } from '../src';
3-
import { poll, TestTerminal } from './_helpers';
4-
import { setTimeout } from 'timers/promises';
3+
import { TestTerminal } from './_helpers';
54

6-
test('subCommands', async () => {
5+
test('subCommands', async ({ expect }) => {
76
const term = new TestTerminal({ cols: 30, rows: 20 });
87

98
await runp({
@@ -28,9 +27,7 @@ test('subCommands', async () => {
2827
linearOutput: true,
2928
});
3029

31-
await poll(
32-
() =>
33-
expect(term.getBuffer()).toMatchInlineSnapshot(`
30+
expect(term.getBuffer()).toMatchInlineSnapshot(`
3431
[
3532
" ",
3633
"-- [subCommand 1] -> ",
@@ -53,7 +50,5 @@ test('subCommands', async () => {
5350
" ",
5451
" ",
5552
]
56-
`),
57-
1000,
58-
);
53+
`);
5954
});

0 commit comments

Comments
 (0)