File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,13 +111,32 @@ async function runTestsInBrowser(testModules, browserType) {
111111
112112 withReporter ( new EchoRunner ( emitter , browserType . toUpperCase ( ) ) ) ;
113113
114+ // collection failures for console printing
115+ const fails = [ ] ;
116+ emitter . on ( 'fail' , ( test , err ) => {
117+ if ( err . stack ) {
118+ const regex = / ( v s \/ .* \. t e s t ) \. j s / ;
119+ for ( let line of String ( err . stack ) . split ( '\n' ) ) {
120+ const match = regex . exec ( line ) ;
121+ if ( match ) {
122+ fails . push ( match [ 1 ] ) ;
123+ break ;
124+ }
125+ }
126+ }
127+ } ) ;
128+
114129 try {
115130 // @ts -ignore
116131 await page . evaluate ( modules => loadAndRun ( modules ) , testModules ) ;
117132 } catch ( err ) {
118133 console . error ( err ) ;
119134 }
120135 await browser . close ( ) ;
136+
137+ if ( fails . length > 0 ) {
138+ return `to DEBUG, open ${ browserType . toUpperCase ( ) } and navigate to ${ target . href } ?${ fails . map ( module => `m=${ module } ` ) . join ( '&' ) } ` ;
139+ }
121140}
122141
123142class EchoRunner extends events . EventEmitter {
@@ -174,7 +193,13 @@ testModules.then(async modules => {
174193
175194 const browserTypes = Array . isArray ( argv . browser ) ? argv . browser : [ argv . browser ] ;
176195 const promises = browserTypes . map ( browserType => runTestsInBrowser ( modules , browserType ) ) ;
177- await Promise . all ( promises ) ;
196+ const messages = await Promise . all ( promises ) ;
197+
198+ for ( let msg of messages ) {
199+ if ( msg ) {
200+ console . log ( msg ) ;
201+ }
202+ }
178203
179204} ) . catch ( err => {
180205 console . error ( err ) ;
You can’t perform that action at this time.
0 commit comments