Skip to content

Commit

Permalink
Fix null case
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 8, 2024
1 parent 3fd35ca commit 3e496df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/e2e-tests/src/puppeteerEnvironment.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ class PuppeteerEnvironment extends JestPuppeteer.TestEnvironment {

async handleTestEvent(event, state) {
if (event.name === 'test_fn_failure' || event.name === 'hook_failure') {
const testName = `${state.currentlyRunningTest.parent.name} ${state.currentlyRunningTest.name}`;
const errors = state.currentlyRunningTest.errors;
const testName =
event.name === 'test_fn_failure'
? `${state.currentlyRunningTest.parent.name} ${state.currentlyRunningTest.name}`
: 'before or after hook';
const errors = state.currentlyRunningTest?.errors || [];
const eventError = util.inspect(event);
let errorMessages = '';
errorMessages += `========= ${testName} ==========\n\n`;
Expand Down

0 comments on commit 3e496df

Please sign in to comment.