Tests: Don't attempt to create echo server if internals is not exposed
This commit is contained in:
parent
37f1e09631
commit
baf654fbc4
1 changed files with 9 additions and 1 deletions
|
@ -121,7 +121,15 @@ class HTTPTestServer {
|
|||
}
|
||||
}
|
||||
|
||||
const __httpTestServer = new HTTPTestServer(`http://localhost:${internals.getEchoServerPort()}`);
|
||||
const __httpTestServer = (function () {
|
||||
if (globalThis.internals && globalThis.internals.getEchoServerPort)
|
||||
return new HTTPTestServer(`http://localhost:${internals.getEchoServerPort()}`);
|
||||
|
||||
return null;
|
||||
})();
|
||||
|
||||
function httpTestServer() {
|
||||
if (!__httpTestServer)
|
||||
throw new Error("window.internals must be exposed to use HTTPTestServer");
|
||||
return __httpTestServer;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue