@@ -9,10 +9,10 @@ test('duration', async () => {
99 env : { CI : '1' } ,
1010 } )
1111
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+ ` )
1616} )
1717
1818test ( 'prints error properties' , async ( ) => {
@@ -32,9 +32,11 @@ test('prints skipped tests by default', async () => {
3232 config : false ,
3333 } )
3434
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+ ` )
3840} )
3941
4042test ( 'hides skipped tests when --hideSkippedTests' , async ( ) => {
@@ -45,9 +47,10 @@ test('hides skipped tests when --hideSkippedTests', async () => {
4547 config : false ,
4648 } )
4749
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+ ` )
5154} )
5255
5356test ( 'prints retry count' , async ( ) => {
@@ -58,8 +61,10 @@ test('prints retry count', async () => {
5861 config : false ,
5962 } )
6063
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+ ` )
6368} )
6469
6570test ( 'prints repeat count' , async ( ) => {
@@ -69,8 +74,10 @@ test('prints repeat count', async () => {
6974 config : false ,
7075 } )
7176
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+ ` )
7481} )
7582
7683test ( 'renders tree when in TTY' , async ( ) => {
@@ -94,14 +101,14 @@ test('renders tree when in TTY', async () => {
94101
95102 expect ( trimReporterOutput ( stdout ) ) . toMatchInlineSnapshot ( `
96103 "❯ fixtures/verbose/example-1.test.ts (10 tests | 1 failed | 4 skipped) [...]ms
97- ✓ test pass in root
104+ ✓ test pass in root [...]ms
98105 ↓ test skip in root
99106 ❯ 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
102109 ❯ 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
105112 ❯ suite in nested suite (1)
106113 × test failure in 2x nested suite [...]ms
107114 ↓ suite skip in root (3)
@@ -110,10 +117,10 @@ test('renders tree when in TTY', async () => {
110117 ↓ test in nested suite
111118 ↓ test failure in nested suite of skipped suite
112119 ✓ fixtures/verbose/example-2.test.ts (3 tests | 1 skipped) [...]ms
113- ✓ test 0.1
120+ ✓ test 0.1 [...]ms
114121 ↓ test 0.2
115122 ✓ suite 1.1 (1)
116- ✓ test 1.1"
123+ ✓ test 1.1 [...]ms "
117124 ` )
118125} )
119126
@@ -137,23 +144,23 @@ test('does not render tree when in non-TTY', async () => {
137144 } )
138145
139146 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
146153 → 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 "
149156 ` )
150157} )
151158
152159function trimReporterOutput ( report : string ) {
153160 const rows = report . replace ( / \d + m s / g, '[...]ms' ) . split ( '\n' )
154161
155162 // 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 ' ) ) )
157164 rows . splice ( rows . findIndex ( row => row . includes ( 'Test Files' ) ) )
158165
159166 return rows . join ( '\n' ) . trim ( )
0 commit comments