diff --git a/packages/engine.io-client/test/webtransport.mjs b/packages/engine.io-client/test/webtransport.mjs index 29866b31f6..94efab1c12 100644 --- a/packages/engine.io-client/test/webtransport.mjs +++ b/packages/engine.io-client/test/webtransport.mjs @@ -1,5 +1,4 @@ import { Http3Server, WebTransport } from "@fails-components/webtransport"; -import { Http3EventLoop } from "@fails-components/webtransport/lib/event-loop.js"; import expect from "expect.js"; import { Server } from "engine.io"; import { Socket } from "../build/esm-debug/index.js"; @@ -16,7 +15,7 @@ async function setup(opts, cb) { const certificate = await generateWebTransportCertificate( [{ shortName: "CN", value: "localhost" }], { - days: 14, // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements) + days: 13, // the total length of the validity period MUST NOT exceed two weeks (https://w3c.github.io/webtransport/#custom-certificate-requirements) }, ); @@ -48,7 +47,10 @@ async function setup(opts, cb) { })(); h3Server.startServer(); - h3Server.onServerListening = () => cb({ engine, h3Server, certificate }); + + await h3Server.ready; + + cb({ engine, h3Server, certificate }); } function success(engine, h3server, done) { @@ -79,10 +81,6 @@ function createSocket(port, certificate, opts) { } describe("WebTransport", () => { - after(() => { - Http3EventLoop.globalLoop.shutdownEventLoop(); // manually shutdown the event loop, instead of waiting 20s - }); - it("should allow to connect with WebTransport directly", (done) => { setup({}, ({ engine, h3Server, certificate }) => { const socket = createSocket(h3Server.port, certificate, {