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

chore: update wpt suite (#24070)

This commit is contained in:
Kenta Moriuchi 2024-06-03 05:47:47 +09:00 committed by GitHub
parent 38ff9faff6
commit f8fdaa082b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 3058 additions and 474 deletions

File diff suppressed because it is too large Load diff

View file

@ -196,7 +196,7 @@ async function generateBundle(location: URL): Promise<string> {
const doc = new DOMParser().parseFromString(body, "text/html"); const doc = new DOMParser().parseFromString(body, "text/html");
assert(doc, "document should have been parsed"); assert(doc, "document should have been parsed");
const scripts = doc.getElementsByTagName("script"); const scripts = doc.getElementsByTagName("script");
const title = doc.getElementsByTagName("title")[0]?.childNodes[0].nodeValue; const title = doc.getElementsByTagName("title")[0]?.childNodes[0]?.nodeValue;
const scriptContents = []; const scriptContents = [];
let inlineScriptCount = 0; let inlineScriptCount = 0;
if (title) { if (title) {

View file

@ -79,7 +79,7 @@ export function getManifest(): Manifest {
const EXPECTATION_PATH = join(ROOT_PATH, "./tests/wpt/runner/expectation.json"); const EXPECTATION_PATH = join(ROOT_PATH, "./tests/wpt/runner/expectation.json");
export interface Expectation { export interface Expectation {
[key: string]: Expectation | boolean | string[]; [key: string]: Expectation | boolean | string[] | { ignore: boolean };
} }
export function getExpectation(): Expectation { export function getExpectation(): Expectation {
@ -90,7 +90,7 @@ export function getExpectation(): Expectation {
export function saveExpectation(expectation: Expectation) { export function saveExpectation(expectation: Expectation) {
Deno.writeTextFileSync( Deno.writeTextFileSync(
EXPECTATION_PATH, EXPECTATION_PATH,
JSON.stringify(expectation, undefined, " "), JSON.stringify(expectation, undefined, " ") + "\n",
); );
} }
@ -99,7 +99,7 @@ export function getExpectFailForCase(
caseName: string, caseName: string,
): boolean { ): boolean {
if (noIgnore) return false; if (noIgnore) return false;
if (typeof expectation == "boolean") { if (typeof expectation === "boolean") {
return !expectation; return !expectation;
} }
return expectation.includes(caseName); return expectation.includes(caseName);

@ -1 +1 @@
Subproject commit abcbb64783af5b776a3c5f4e13cf4d8756217830 Subproject commit a14e908e1fd7c6e848ef60df044af1c040a012d2

View file

@ -246,12 +246,12 @@ async function run() {
}; };
minifiedResults.push(minified); minifiedResults.push(minified);
} }
await Deno.writeTextFile(json, JSON.stringify(minifiedResults)); await Deno.writeTextFile(json, JSON.stringify(minifiedResults) + "\n");
} }
if (wptreport) { if (wptreport) {
const report = await generateWptReport(results, startTime, endTime); const report = await generateWptReport(results, startTime, endTime);
await Deno.writeTextFile(wptreport, JSON.stringify(report)); await Deno.writeTextFile(wptreport, JSON.stringify(report) + "\n");
} }
const code = reportFinal(results, endTime - startTime); const code = reportFinal(results, endTime - startTime);
@ -385,7 +385,7 @@ async function update() {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
if (json) { if (json) {
await Deno.writeTextFile(json, JSON.stringify(results)); await Deno.writeTextFile(json, JSON.stringify(results) + "\n");
} }
const resultTests: Record< const resultTests: Record<
@ -447,7 +447,7 @@ function insertExpectation(
assert(segment, "segments array must never be empty"); assert(segment, "segments array must never be empty");
if (segments.length > 0) { if (segments.length > 0) {
if ( if (
!currentExpectation[segment] || currentExpectation[segment] === undefined ||
Array.isArray(currentExpectation[segment]) || Array.isArray(currentExpectation[segment]) ||
typeof currentExpectation[segment] === "boolean" typeof currentExpectation[segment] === "boolean"
) { ) {
@ -459,7 +459,14 @@ function insertExpectation(
finalExpectation, finalExpectation,
); );
} else { } else {
currentExpectation[segment] = finalExpectation; if (
currentExpectation[segment] === undefined ||
Array.isArray(currentExpectation[segment]) ||
typeof currentExpectation[segment] === "boolean" ||
(currentExpectation[segment] as { ignore: boolean })?.ignore !== true
) {
currentExpectation[segment] = finalExpectation;
}
} }
} }