1
1
import pluralize from 'pluralize' ;
2
2
3
+ import { isE2EBuild } from '../../lib/e2eUtils' ;
3
4
import { getDuration } from '../../lib/tasks' ;
4
5
import { progressBar } from '../../lib/utils' ;
5
6
import { Context } from '../../types' ;
6
7
7
- export const initial = {
8
+ const testType = ( ctx : Context ) => ( isE2EBuild ( ctx . options ) ? 'test suite' : 'stories' ) ;
9
+
10
+ export const initial = ( ctx : Context ) => ( {
8
11
status : 'initial' ,
9
- title : ' Test your stories' ,
10
- } ;
12
+ title : ` Test your ${ testType ( ctx ) } ` ,
13
+ } ) ;
11
14
12
- export const dryRun = ( ) => ( {
15
+ export const dryRun = ( ctx : Context ) => ( {
13
16
status : 'skipped' ,
14
- title : ' Test your stories' ,
17
+ title : ` Test your ${ testType ( ctx ) } ` ,
15
18
output : 'Skipped due to --dry-run' ,
16
19
} ) ;
17
20
@@ -33,6 +36,7 @@ export const stats = ({
33
36
errors : pluralize ( 'component error' , build . errorCount , true ) ,
34
37
changes : pluralize ( 'change' , build . changeCount , true ) ,
35
38
stories : pluralize ( 'story' , build . specCount , true ) ,
39
+ e2eTests : pluralize ( 'test' , build . specCount , true ) ,
36
40
components : pluralize ( 'component' , build . componentCount , true ) ,
37
41
skips : pluralize ( 'test' , build . testCount - build . actualTestCount , true ) ,
38
42
snapshots : pluralize ( 'snapshot' , build . actualCaptureCount , true ) ,
@@ -70,31 +74,43 @@ export const pending = (ctx: Context, { cursor = 0, label = '' } = {}) => {
70
74
} ;
71
75
72
76
export const buildPassed = ( ctx : Context ) => {
73
- const { snapshots, components, stories } = stats ( ctx ) ;
77
+ const { snapshots, components, stories, e2eTests } = stats ( ctx ) ;
78
+ const output = isE2EBuild ( ctx . options )
79
+ ? `Tested ${ e2eTests } ; captured ${ snapshots } in ${ getDuration ( ctx ) } `
80
+ : `Tested ${ stories } across ${ components } ; captured ${ snapshots } in ${ getDuration ( ctx ) } ` ;
81
+
74
82
return {
75
83
status : 'success' ,
76
84
title : `Build ${ ctx . build . number } passed!` ,
77
- output : `Tested ${ stories } across ${ components } ; captured ${ snapshots } in ${ getDuration ( ctx ) } ` ,
85
+ output,
78
86
} ;
79
87
} ;
80
88
81
89
export const buildComplete = ( ctx : Context ) => {
82
- const { snapshots, components, stories } = stats ( ctx ) ;
90
+ const { snapshots, components, stories, e2eTests } = stats ( ctx ) ;
91
+ const output = isE2EBuild ( ctx . options )
92
+ ? `Tested ${ e2eTests } ; captured ${ snapshots } in ${ getDuration ( ctx ) } `
93
+ : `Tested ${ stories } across ${ components } ; captured ${ snapshots } in ${ getDuration ( ctx ) } ` ;
94
+
83
95
return {
84
96
status : 'success' ,
85
97
title : ctx . build . autoAcceptChanges
86
98
? `Build ${ ctx . build . number } auto-accepted`
87
99
: `Build ${ ctx . build . number } completed` ,
88
- output : `Tested ${ stories } across ${ components } ; captured ${ snapshots } in ${ getDuration ( ctx ) } ` ,
100
+ output,
89
101
} ;
90
102
} ;
91
103
92
104
export const buildBroken = ( ctx : Context ) => {
93
- const { snapshots, components, stories, errors } = stats ( ctx ) ;
105
+ const { snapshots, components, stories, e2eTests, errors } = stats ( ctx ) ;
106
+ const output = isE2EBuild ( ctx . options )
107
+ ? `Tested ${ e2eTests } ; captured ${ snapshots } and found ${ errors } `
108
+ : `Tested ${ stories } across ${ components } ; captured ${ snapshots } and found ${ errors } ` ;
109
+
94
110
return {
95
111
status : 'error' ,
96
112
title : `Build ${ ctx . build . number } failed after ${ getDuration ( ctx ) } ` ,
97
- output : `Tested ${ stories } across ${ components } ; captured ${ snapshots } and found ${ errors } ` ,
113
+ output,
98
114
} ;
99
115
} ;
100
116
@@ -117,7 +133,7 @@ export const buildCanceled = (ctx: Context) => {
117
133
export const skipped = ( ctx : Context ) => {
118
134
return {
119
135
status : 'skipped' ,
120
- title : ' Test your stories' ,
136
+ title : ` Test your ${ testType ( ctx ) } ` ,
121
137
output : ctx . isPublishOnly
122
138
? `No UI tests or UI review enabled`
123
139
: `Skipped due to ${ ctx . options . list ? '--list' : '--exit-once-uploaded' } ` ,
0 commit comments