Skip to content

Commit

Permalink
ci: Capture and log the error nicely when we can get the console logs (
Browse files Browse the repository at this point in the history
  • Loading branch information
scinos authored Apr 26, 2021
1 parent e2db1d5 commit 73ac77a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions test/e2e/lib/hooks/save-console-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@ export default () => {
after( 'Save browser logs', async function () {
const driver = global.__BROWSER__;

await Promise.allSettled(
[
[ getBrowserLogs( driver ), 'console.log' ],
[ getPerformanceLogs( driver ), 'performance.log' ],
].map( async ( [ logsPromise, file ] ) => {
const logs = await logsPromise;
return fs.writeFile( generatePath( file ), JSON.stringify( logs, null, 2 ) );
} )
);
try {
await Promise.allSettled(
[
[ getBrowserLogs( driver ), 'console.log' ],
[ getPerformanceLogs( driver ), 'performance.log' ],
].map( async ( [ logsPromise, file ] ) => {
const logs = await logsPromise;
return fs.writeFile( generatePath( file ), JSON.stringify( logs, null, 2 ) );
} )
);
} catch ( err ) {
console.warn(
'Got an error trying to save logs from the browser. This IS NOT causing the test to break, is just a warning'
);
console.warn( 'Original error:' );
console.warn( err );
}
} );
};

0 comments on commit 73ac77a

Please sign in to comment.