diff --git a/scripts/flake-check.mjs b/scripts/flake-check.mjs index 3dd4fe570d..ee23cd76cc 100644 --- a/scripts/flake-check.mjs +++ b/scripts/flake-check.mjs @@ -1115,6 +1115,8 @@ function repeatNode(files, iterations) { // Per-test statuses of a `dart test` JSON report (one event per line), keyed // ` › `. Hidden entries are the runner's own file-loading steps. +// A test declared through a helper (every `testWidgets`) has the helper's +// `package:` url; `root_url` then names the suite file. export function parseDartReport(text, mobileRoot = `${root}mobile/`) { const started = new Map(); const statuses = new Map(); @@ -1129,7 +1131,10 @@ export function parseDartReport(text, mobileRoot = `${root}mobile/`) { if (event.type !== "testDone" || event.hidden) continue; const test = started.get(event.testID); if (!test) continue; - const file = fileURLToPath(test.url ?? "file:///").replace(mobileRoot, ""); + const file = fileURLToPath(test.root_url ?? test.url ?? "file:///").replace( + mobileRoot, + "", + ); statuses.set( `${file} › ${test.name}`, event.skipped diff --git a/scripts/flake-check.test.mjs b/scripts/flake-check.test.mjs index 5450e484a1..555142059c 100644 --- a/scripts/flake-check.test.mjs +++ b/scripts/flake-check.test.mjs @@ -951,6 +951,15 @@ test("reports give per-test statuses per iteration", () => { type: "testStart", test: { id: 4, name: "later", url: "file:///m/test/b_test.dart" }, }), + event({ + type: "testStart", + test: { + id: 5, + name: "widget", + url: "package:flutter_test/src/widget_tester.dart", + root_url: "file:///m/test/b_test.dart", + }, + }), "not json", event({ type: "testDone", @@ -973,6 +982,13 @@ test("reports give per-test statuses per iteration", () => { hidden: false, skipped: true, }), + event({ + type: "testDone", + testID: 5, + result: "success", + hidden: false, + skipped: false, + }), event({ type: "done", success: false }), ].join("\n"), "/m/", @@ -981,6 +997,7 @@ test("reports give per-test statuses per iteration", () => { ["test/a_test.dart › group renders", "passed"], ["test/a_test.dart › group fails", "failed"], ["test/b_test.dart › later", "skipped"], + ["test/b_test.dart › widget", "passed"], ]), ); // Playwright lists a --repeat-each journey once per repetition, in order.