mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
try to handle ConnectionReset error in windows CI for unit tests (#4407)
This commit is contained in:
parent
9050d36d57
commit
4a4894532e
2 changed files with 34 additions and 18 deletions
|
@ -127,31 +127,46 @@ async function runTestsForPermissionSet(
|
|||
// Wait for worker subprocess to go online
|
||||
const conn = await listener.accept();
|
||||
|
||||
let err: Error | undefined = undefined;
|
||||
let expectedPassedTests;
|
||||
let endEvent;
|
||||
|
||||
for await (const line of readLines(conn)) {
|
||||
const msg = JSON.parse(line);
|
||||
try {
|
||||
for await (const line of readLines(conn)) {
|
||||
const msg = JSON.parse(line);
|
||||
|
||||
if (msg.kind === Deno.TestEvent.Start) {
|
||||
expectedPassedTests = msg.tests;
|
||||
await reporter.start(msg);
|
||||
continue;
|
||||
} else if (msg.kind === Deno.TestEvent.TestStart) {
|
||||
await reporter.testStart(msg);
|
||||
continue;
|
||||
} else if (msg.kind === Deno.TestEvent.TestEnd) {
|
||||
await reporter.testEnd(msg);
|
||||
continue;
|
||||
} else {
|
||||
endEvent = msg;
|
||||
await reporter.end(msg);
|
||||
break;
|
||||
if (msg.kind === Deno.TestEvent.Start) {
|
||||
expectedPassedTests = msg.tests;
|
||||
await reporter.start(msg);
|
||||
continue;
|
||||
} else if (msg.kind === Deno.TestEvent.TestStart) {
|
||||
await reporter.testStart(msg);
|
||||
continue;
|
||||
} else if (msg.kind === Deno.TestEvent.TestEnd) {
|
||||
await reporter.testEnd(msg);
|
||||
continue;
|
||||
} else {
|
||||
endEvent = msg;
|
||||
await reporter.end(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
err = e;
|
||||
} finally {
|
||||
// Close socket to worker, it should shutdown gracefully.
|
||||
conn.close();
|
||||
}
|
||||
|
||||
// Close socket to worker, it should shutdown gracefully.
|
||||
conn.close();
|
||||
if (err) {
|
||||
if (err instanceof Deno.errors.ConnectionReset) {
|
||||
if (!endEvent) {
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof expectedPassedTests === "undefined") {
|
||||
throw new Error("Worker runner didn't report start");
|
||||
|
|
|
@ -275,6 +275,7 @@ fn js_unit_tests() {
|
|||
.arg("-A")
|
||||
.arg("cli/js/tests/unit_test_runner.ts")
|
||||
.arg("--master")
|
||||
.arg("--verbose")
|
||||
.spawn()
|
||||
.expect("failed to spawn script");
|
||||
let status = deno.wait().expect("failed to wait for the child process");
|
||||
|
|
Loading…
Reference in a new issue