Skip to content

Commit

Permalink
Fixed "Cypress stops after 3 tests in Storybook"
Browse files Browse the repository at this point in the history
When running in Storybook, after 3 tests, Cypress will hang on "loading iframe.html".

By ensuring that the EventSource is closed `onbeforeunload`, this fixes the issue.
  • Loading branch information
jamesikanos authored and Svish committed Dec 23, 2022
1 parent a2532bb commit 7a362ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gatsby.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Cypress.on('window:load', (win) => {
break;
}
});

win.onbeforeunload = () => {
// Ensure that the source is closed if the window is unloaded
console.debug(LOG_TAG, `Close the HMR Connection`);
source.close();
}
});

function getUrl() {
Expand Down

0 comments on commit 7a362ab

Please sign in to comment.