1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00

chore(wpt): clean up temporary files created by the WPT test runner (#11108)

Fixes #11107.
This commit is contained in:
Andreu Botella 2021-06-24 21:07:36 +02:00 committed by GitHub
parent 586586b791
commit be5d2983b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,60 +82,65 @@ export async function runSingleTest(
prefix: "wpt-bundle-",
suffix: ".js",
});
await Deno.writeTextFile(tempFile, bundle);
const startTime = new Date().getTime();
try {
await Deno.writeTextFile(tempFile, bundle);
const proc = Deno.run({
cmd: [
denoBinary(),
"run",
"-A",
"--unstable",
"--location",
url.toString(),
"--cert",
join(ROOT_PATH, `./tools/wpt/certs/cacert.pem`),
tempFile,
"[]",
],
env: {
NO_COLOR: "1",
},
stdout: "null",
stderr: "piped",
});
const startTime = new Date().getTime();
const cases = [];
let stderr = "";
const proc = Deno.run({
cmd: [
denoBinary(),
"run",
"-A",
"--unstable",
"--location",
url.toString(),
"--cert",
join(ROOT_PATH, `./tools/wpt/certs/cacert.pem`),
tempFile,
"[]",
],
env: {
NO_COLOR: "1",
},
stdout: "null",
stderr: "piped",
});
let harnessStatus = null;
const cases = [];
let stderr = "";
const lines = readLines(proc.stderr);
for await (const line of lines) {
if (line.startsWith("{")) {
const data = JSON.parse(line);
const result = { ...data, passed: data.status == 0 };
cases.push(result);
reporter(result);
} else if (line.startsWith("#$#$#{")) {
harnessStatus = JSON.parse(line.slice(5));
} else {
stderr += line + "\n";
console.error(line);
let harnessStatus = null;
const lines = readLines(proc.stderr);
for await (const line of lines) {
if (line.startsWith("{")) {
const data = JSON.parse(line);
const result = { ...data, passed: data.status == 0 };
cases.push(result);
reporter(result);
} else if (line.startsWith("#$#$#{")) {
harnessStatus = JSON.parse(line.slice(5));
} else {
stderr += line + "\n";
console.error(line);
}
}
const duration = new Date().getTime() - startTime;
const { code } = await proc.status();
return {
status: code,
harnessStatus,
duration,
cases,
stderr,
};
} finally {
await Deno.remove(tempFile);
}
const duration = new Date().getTime() - startTime;
const { code } = await proc.status();
return {
status: code,
harnessStatus,
duration,
cases,
stderr,
};
}
async function generateBundle(location: URL): Promise<string> {