Skip to content

Commit

Permalink
fix flaky test issue
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Dec 9, 2024
1 parent 81a5a9e commit 2738858
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ const connectToDApp = (tabId: number): Promise<chrome.runtime.Port> => {
resolve(port)
}

if (process.env.NODE_ENV === 'test' && port == null) {
// This can happen in tests because of the timeout above
// If you have a better solution, go ahead :)
return promise
}

port.onMessage.addListener(handleConnect)

return promise
Expand Down

0 comments on commit 2738858

Please sign in to comment.