Skip to content

Commit d4820bd

Browse files
authored
Merge pull request #39 from camillobruni/2025-01-28_test_runner_fix
Fix end2end tests
2 parents 4f874f4 + 238bd9b commit d4820bd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/run.mjs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,27 @@ async function testEnd2End() {
8383
try {
8484
await driver.get(`http://localhost:${PORT}/index.html?worstCaseCount=2&iterationCount=3`);
8585
await driver.executeAsyncScript((callback) => {
86-
globalThis.addEventListener("JetStreamReady", callback);
86+
// callback() is explicitly called without the default event
87+
// as argument to avoid serialization issues with chromedriver.
88+
globalThis.addEventListener("JetStreamReady", () => callback());
8789
// We might not get a chance to install the on-ready listener, thus
8890
// we also check if the runner is ready synchronously.
8991
if (globalThis?.JetStream?.isReady)
9092
callback()
9193
});
92-
await driver.manage().setTimeouts({ script: 60_000 });
94+
await driver.manage().setTimeouts({ script: 3 * 60_000 });
9395
results = await driver.executeAsyncScript((callback) => {
9496
globalThis.addEventListener("JetStreamDone", event => callback(event.detail));
9597
JetStream.start();
9698
});
97-
} finally {
98-
console.log("\nTests complete!");
99+
console.log("\n✅ Tests completed!");
100+
console.log("RESULTS:")
99101
console.log(results)
102+
} catch(e) {
103+
console.error("\n❌ Tests failed!");
104+
console.error(e);
105+
throw e;
106+
} finally {
100107
driver.quit();
101108
server.close();
102109
}

0 commit comments

Comments
 (0)