-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
stdin.test.ts
45 lines (31 loc) · 964 Bytes
/
stdin.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { expect, test } from 'vitest'
import { startWatchMode, waitFor } from './utils'
test('quit watch mode', async () => {
const vitest = await startWatchMode()
vitest.write('q')
await vitest.isDone
})
test('filter by filename', async () => {
const vitest = await startWatchMode()
vitest.write('p')
await waitFor(() => {
expect(vitest.getOutput()).toMatch('Input filename pattern')
})
vitest.write('math\n')
await waitFor(() => {
expect(vitest.getOutput()).toMatch('Filename pattern: math')
expect(vitest.getOutput()).toMatch('1 passed')
})
})
test('filter by test name', async () => {
const vitest = await startWatchMode()
vitest.write('t')
await waitFor(() => {
expect(vitest.getOutput()).toMatch('Input test name pattern')
})
vitest.write('sum\n')
await waitFor(() => {
expect(vitest.getOutput()).toMatch('Test name pattern: /sum/')
expect(vitest.getOutput()).toMatch('1 passed')
})
})