Skip to content

Commit 4a87566

Browse files
committed
chore: unit tests
1 parent 15fc103 commit 4a87566

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

TestRunner/app/tests/HttpEsmLoaderTests.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,7 @@ describe("HTTP ESM Loader", function() {
3535
try {
3636
var reportUrl = NSProcessInfo.processInfo.environment.objectForKey("REPORT_BASEURL");
3737
if (!reportUrl) return null;
38-
// REPORT_BASEURL is like: http://[::1]:63846/junit_report
39-
// In CI the host may be bound to IPv6 loopback; normalize to IPv4 loopback to avoid
40-
// simulator connectivity issues/timeouts when importing HTTP modules.
4138
var u = new URL(String(reportUrl));
42-
var host = String(u.hostname);
43-
if (host === "::1" || host === "localhost") {
44-
u.hostname = "127.0.0.1";
45-
}
4639
return u.origin;
4740
} catch (e) {
4841
return null;
@@ -262,7 +255,7 @@ describe("HTTP ESM Loader", function() {
262255
done();
263256
})
264257
.catch(function (error) {
265-
fail(new Error("Expected hot-data test modules to import: " + formatError(error)));
258+
fail("Expected hot-data test modules to import: " + formatError(error));
266259
done();
267260
});
268261
});
@@ -305,7 +298,7 @@ describe("HTTP ESM Loader", function() {
305298
done();
306299
})
307300
.catch(function (error) {
308-
fail(new Error("Expected hot.data sharing assertions to succeed: " + formatError(error)));
301+
fail("Expected hot.data sharing assertions to succeed: " + formatError(error));
309302
done();
310303
});
311304
});
@@ -333,7 +326,7 @@ describe("HTTP ESM Loader", function() {
333326
});
334327
})
335328
.catch(function (error) {
336-
fail(new Error("Expected host HTTP module imports to succeed: " + formatError(error)));
329+
fail("Expected host HTTP module imports to succeed: " + formatError(error));
337330
done();
338331
});
339332
});
@@ -360,7 +353,7 @@ describe("HTTP ESM Loader", function() {
360353
});
361354
})
362355
.catch(function (error) {
363-
fail(new Error("Expected dev-endpoint HTTP module imports to succeed: " + formatError(error)));
356+
fail("Expected dev-endpoint HTTP module imports to succeed: " + formatError(error));
364357
done();
365358
});
366359
});
@@ -385,7 +378,7 @@ describe("HTTP ESM Loader", function() {
385378
});
386379
})
387380
.catch(function (error) {
388-
fail(new Error("Expected dev-endpoint HTTP module imports to succeed: " + formatError(error)));
381+
fail("Expected dev-endpoint HTTP module imports to succeed: " + formatError(error));
389382
done();
390383
});
391384
});
@@ -409,7 +402,7 @@ describe("HTTP ESM Loader", function() {
409402
});
410403
})
411404
.catch(function (error) {
412-
fail(new Error("Expected fragment HTTP module imports to succeed: " + formatError(error)));
405+
fail("Expected fragment HTTP module imports to succeed: " + formatError(error));
413406
done();
414407
});
415408
});

TestRunnerTests/TestRunnerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TestRunnerTests: XCTestCase {
1212
runtimeUnitTestsExpectation = self.expectation(description: "Jasmine tests")
1313

1414
loop = try! SelectorEventLoop(selector: try! KqueueSelector())
15-
self.server = DefaultHTTPServer(eventLoop: loop!, port: port) {
15+
self.server = DefaultHTTPServer(eventLoop: loop!, interface: "127.0.0.1", port: port) {
1616
(
1717
environ: [String: Any],
1818
startResponse: @escaping ((String, [(String, String)]) -> Void),
@@ -108,7 +108,7 @@ class TestRunnerTests: XCTestCase {
108108

109109
func testRuntime() {
110110
let app = XCUIApplication()
111-
app.launchEnvironment["REPORT_BASEURL"] = "http://[::1]:\(port)/junit_report"
111+
app.launchEnvironment["REPORT_BASEURL"] = "http://127.0.0.1:\(port)/junit_report"
112112
app.launch()
113113

114114
wait(for: [runtimeUnitTestsExpectation], timeout: 300.0, enforceOrder: true)

0 commit comments

Comments
 (0)