@@ -9,10 +9,10 @@ test('duration', async () => {
9
9
env : { CI : '1' } ,
10
10
} )
11
11
12
- expect ( trimReporterOutput ( stdout ) ) . toContain ( `
13
- ✓ basic.test.ts > fast
14
- ✓ basic.test.ts > slow [...]ms` ,
15
- )
12
+ expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
13
+ " ✓ basic.test.ts > fast [...]ms
14
+ ✓ basic.test.ts > slow [...]ms"
15
+ ` )
16
16
} )
17
17
18
18
test ( 'prints error properties' , async ( ) => {
@@ -32,9 +32,11 @@ test('prints skipped tests by default', async () => {
32
32
config : false ,
33
33
} )
34
34
35
- expect ( stdout ) . toContain ( '✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped)' )
36
- expect ( stdout ) . toContain ( '✓ 2 + 3 = 5' )
37
- expect ( stdout ) . toContain ( '↓ 3 + 3 = 6' )
35
+ expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
36
+ "✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped) [...]ms
37
+ ✓ 2 + 3 = 5 [...]ms
38
+ ↓ 3 + 3 = 6"
39
+ ` )
38
40
} )
39
41
40
42
test ( 'hides skipped tests when --hideSkippedTests' , async ( ) => {
@@ -45,9 +47,10 @@ test('hides skipped tests when --hideSkippedTests', async () => {
45
47
config : false ,
46
48
} )
47
49
48
- expect ( stdout ) . toContain ( '✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped)' )
49
- expect ( stdout ) . toContain ( '✓ 2 + 3 = 5' )
50
- expect ( stdout ) . not . toContain ( '↓ 3 + 3 = 6' )
50
+ expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
51
+ "✓ fixtures/all-passing-or-skipped.test.ts (2 tests | 1 skipped) [...]ms
52
+ ✓ 2 + 3 = 5 [...]ms"
53
+ ` )
51
54
} )
52
55
53
56
test ( 'prints retry count' , async ( ) => {
@@ -58,8 +61,10 @@ test('prints retry count', async () => {
58
61
config : false ,
59
62
} )
60
63
61
- expect ( stdout ) . toContain ( '1 passed' )
62
- expect ( stdout ) . toContain ( '✓ pass after retries (retry x3)' )
64
+ expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
65
+ "✓ fixtures/retry.test.ts (1 test) [...]ms
66
+ ✓ pass after retries [...]ms (retry x3)"
67
+ ` )
63
68
} )
64
69
65
70
test ( 'prints repeat count' , async ( ) => {
@@ -69,8 +74,10 @@ test('prints repeat count', async () => {
69
74
config : false ,
70
75
} )
71
76
72
- expect ( stdout ) . toContain ( '1 passed' )
73
- expect ( stdout ) . toContain ( '✓ repeat couple of times (repeat x3)' )
77
+ expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
78
+ "✓ fixtures/repeats.test.ts (1 test) [...]ms
79
+ ✓ repeat couple of times [...]ms (repeat x3)"
80
+ ` )
74
81
} )
75
82
76
83
test ( 'renders tree when in TTY' , async ( ) => {
@@ -94,14 +101,14 @@ test('renders tree when in TTY', async () => {
94
101
95
102
expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
96
103
"❯ fixtures/verbose/example-1.test.ts (10 tests | 1 failed | 4 skipped) [...]ms
97
- ✓ test pass in root
104
+ ✓ test pass in root [...]ms
98
105
↓ test skip in root
99
106
❯ suite in root (5)
100
- ✓ test pass in 1. suite #1
101
- ✓ test pass in 1. suite #2
107
+ ✓ test pass in 1. suite #1 [...]ms
108
+ ✓ test pass in 1. suite #2 [...]ms
102
109
❯ suite in suite (3)
103
- ✓ test pass in nested suite #1
104
- ✓ test pass in nested suite #2
110
+ ✓ test pass in nested suite #1 [...]ms
111
+ ✓ test pass in nested suite #2 [...]ms
105
112
❯ suite in nested suite (1)
106
113
× test failure in 2x nested suite [...]ms
107
114
↓ suite skip in root (3)
@@ -110,10 +117,10 @@ test('renders tree when in TTY', async () => {
110
117
↓ test in nested suite
111
118
↓ test failure in nested suite of skipped suite
112
119
✓ fixtures/verbose/example-2.test.ts (3 tests | 1 skipped) [...]ms
113
- ✓ test 0.1
120
+ ✓ test 0.1 [...]ms
114
121
↓ test 0.2
115
122
✓ suite 1.1 (1)
116
- ✓ test 1.1"
123
+ ✓ test 1.1 [...]ms "
117
124
` )
118
125
} )
119
126
@@ -137,23 +144,23 @@ test('does not render tree when in non-TTY', async () => {
137
144
} )
138
145
139
146
expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
140
- "✓ fixtures/verbose/example-1.test.ts > test pass in root
141
- ✓ fixtures/verbose/example-1.test.ts > suite in root > test pass in 1. suite #1
142
- ✓ fixtures/verbose/example-1.test.ts > suite in root > test pass in 1. suite #2
143
- ✓ fixtures/verbose/example-1.test.ts > suite in root > suite in suite > test pass in nested suite #1
144
- ✓ fixtures/verbose/example-1.test.ts > suite in root > suite in suite > test pass in nested suite #2
145
- × fixtures/verbose/example-1.test.ts > suite in root > suite in suite > suite in nested suite > test failure in 2x nested suite
147
+ "✓ fixtures/verbose/example-1.test.ts > test pass in root [...]ms
148
+ ✓ fixtures/verbose/example-1.test.ts > suite in root > test pass in 1. suite #1 [...]ms
149
+ ✓ fixtures/verbose/example-1.test.ts > suite in root > test pass in 1. suite #2 [...]ms
150
+ ✓ fixtures/verbose/example-1.test.ts > suite in root > suite in suite > test pass in nested suite #1 [...]ms
151
+ ✓ fixtures/verbose/example-1.test.ts > suite in root > suite in suite > test pass in nested suite #2 [...]ms
152
+ × fixtures/verbose/example-1.test.ts > suite in root > suite in suite > suite in nested suite > test failure in 2x nested suite [...]ms
146
153
→ expected 'should fail' to be 'as expected' // Object.is equality
147
- ✓ fixtures/verbose/example-2.test.ts > test 0.1
148
- ✓ fixtures/verbose/example-2.test.ts > suite 1.1 > test 1.1"
154
+ ✓ fixtures/verbose/example-2.test.ts > test 0.1 [...]ms
155
+ ✓ fixtures/verbose/example-2.test.ts > suite 1.1 > test 1.1 [...]ms "
149
156
` )
150
157
} )
151
158
152
159
function trimReporterOutput ( report : string ) {
153
160
const rows = report . replace ( / \d + m s / g, '[...]ms' ) . split ( '\n' )
154
161
155
162
// Trim start and end, capture just rendered tree
156
- rows . splice ( 0 , rows . findIndex ( row => row . includes ( 'fixtures/verbose/example- ' ) ) )
163
+ rows . splice ( 0 , 1 + rows . findIndex ( row => row . includes ( 'RUN v ' ) ) )
157
164
rows . splice ( rows . findIndex ( row => row . includes ( 'Test Files' ) ) )
158
165
159
166
return rows . join ( '\n' ) . trim ( )
0 commit comments