File tree 3 files changed +42
-3
lines changed
3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,16 @@ export function buildHandler(config, state) {
63
63
await config . cleanup ( ) ;
64
64
debug ( `Configured cleanup hook completed` ) ;
65
65
}
66
+ debug ( `\n\nExiting with code ${ exitCode } ` ) ;
66
67
// 1. We expect all cleanup to have happened after
67
68
// config.cleanup(), so exiting here should be safe.
68
69
// 2. We also want to forcibly exit with a success code in this
69
70
// case.
70
71
// eslint-disable-next-line n/no-process-exit
71
72
process . exit ( exitCode ) ;
72
73
}
74
+ } else {
75
+ console . log ( `Waiting for ${ state . expected - state . completed } more browsers to finish` ) ;
73
76
}
74
77
75
78
break ;
Original file line number Diff line number Diff line change 1
1
import chalk from 'chalk' ;
2
2
import fs from 'fs' ;
3
3
import path from 'path' ;
4
+ import { exit } from 'process' ;
4
5
5
6
const SLOW_TEST_COUNT = 50 ;
6
7
const DEFAULT_TIMEOUT = 8_000 ;
@@ -184,6 +185,13 @@ export default class CustomDotReporter {
184
185
)
185
186
) ;
186
187
}
188
+ if ( this . globalFailures . length ) {
189
+ this . write (
190
+ chalk . red (
191
+ `\n\n${ this . globalFailures . length } Global Failures were detected.. Complete stack traces for failures will print at the end.`
192
+ )
193
+ ) ;
194
+ }
187
195
this . write ( `\n\n` ) ;
188
196
189
197
this . reportPendingTests ( ) ;
@@ -212,9 +220,10 @@ export default class CustomDotReporter {
212
220
) } ms\n${ HEADER_STR } \n\n`
213
221
) ;
214
222
223
+ const exitCode = this . globalFailures . length || this . failedTests . length ? 1 : 0 ;
215
224
this . clearState ( ) ;
216
225
217
- return this . failedTests . length ? 1 : 0 ;
226
+ return exitCode ;
218
227
}
219
228
220
229
addLauncher ( data ) {
Original file line number Diff line number Diff line change @@ -67,7 +67,20 @@ export async function runTest<TC extends TestContext>(
67
67
}
68
68
69
69
for ( const hook of beforeChain ) {
70
- await hook . call ( testContext , Assert ) ;
70
+ try {
71
+ await hook . call ( testContext , Assert ) ;
72
+ } catch ( err ) {
73
+ Assert . pushResult ( {
74
+ message : `Unexpected Test Failure in beforeEach: ${ ( err as Error ) . message } ` ,
75
+ stack : ( err as Error ) . stack ! ,
76
+ passed : false ,
77
+ actual : false ,
78
+ expected : true ,
79
+ } ) ;
80
+ if ( ! Config . params . tryCatch . value ) {
81
+ throw err ;
82
+ }
83
+ }
71
84
}
72
85
73
86
try {
@@ -91,7 +104,21 @@ export async function runTest<TC extends TestContext>(
91
104
}
92
105
} finally {
93
106
for ( const hook of afterChain ) {
94
- await hook . call ( testContext , Assert ) ;
107
+ try {
108
+ await hook . call ( testContext , Assert ) ;
109
+ } catch ( e ) {
110
+ Assert . pushResult ( {
111
+ message : `Unexpected Test Failure in afterEach: ${ ( e as Error ) . message } ` ,
112
+ stack : ( e as Error ) . stack ! ,
113
+ passed : false ,
114
+ actual : false ,
115
+ expected : true ,
116
+ } ) ;
117
+ if ( ! Config . params . tryCatch . value ) {
118
+ // eslint-disable-next-line no-unsafe-finally
119
+ throw e ;
120
+ }
121
+ }
95
122
}
96
123
Assert . _finalize ( ) ;
97
124
You can’t perform that action at this time.
0 commit comments