forked from vitest-dev/vitest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverbose.test.ts
More file actions
51 lines (43 loc) · 1.52 KB
/
verbose.test.ts
File metadata and controls
51 lines (43 loc) · 1.52 KB
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
46
47
48
49
50
51
import { expect, test } from 'vitest'
import { runVitest } from '../../test-utils'
test('duration', async () => {
const result = await runVitest({
root: 'fixtures/duration',
reporters: 'verbose',
env: { CI: '1' },
})
const output = result.stdout.replaceAll(/\d+ms/g, '[...]ms')
expect(output).toContain(`
✓ basic.test.ts > fast
✓ basic.test.ts > slow [...]ms
`)
})
test('prints error properties', async () => {
const result = await runVitest({
root: 'fixtures/error-props',
reporters: 'verbose',
env: { CI: '1' },
})
expect(result.stderr).toContain(`Serialized Error: { code: 404, status: 'not found' }`)
})
test('prints skipped tests by default', async () => {
const { stdout } = await runVitest({
include: ['fixtures/all-passing-or-skipped.test.ts'],
reporters: [['verbose', { isTTY: true, summary: false }]],
config: false,
})
expect(stdout).toContain('✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped)')
expect(stdout).toContain('✓ 2 + 3 = 5')
expect(stdout).toContain('↓ 3 + 3 = 6')
})
test('hides skipped tests when --hideSkippedTests', async () => {
const { stdout } = await runVitest({
include: ['fixtures/all-passing-or-skipped.test.ts'],
reporters: [['verbose', { isTTY: true, summary: false }]],
hideSkippedTests: true,
config: false,
})
expect(stdout).toContain('✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped)')
expect(stdout).toContain('✓ 2 + 3 = 5')
expect(stdout).not.toContain('↓ 3 + 3 = 6')
})