-
Notifications
You must be signed in to change notification settings - Fork 60
cross-runtime: run node:test files under bun test, matching the deno treatment #820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
4358a7a
61a3c87
1b5017b
50bdd37
10d6f70
8954631
c95ec26
07daa4e
d0ce522
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,9 +85,97 @@ for (const blk of BLOCKS) { | |
| console.log(expected + "\n"); | ||
| } | ||
| } | ||
| // The published figures are hand-copied onto four surfaces and nothing else | ||
| // rechecks them — the homepage COMPAT array, the blog sentence and the wiki | ||
| // research doc all drifted when a re-measurement moved a score, and this | ||
| // README's own retry-flip sentence went stale twice in one PR. --check | ||
| // compares every one against results.json; a missing file exits 2 | ||
| // (uncheckable), a mismatch exits 1 like table drift. | ||
| function checkHandCopies() { | ||
| const by = (lens) => { | ||
| const s = results.scores[lens]; | ||
| const m = Object.fromEntries(s.runtimes.map((r) => [r.runtime, r])); | ||
| return { rate: (rt) => (m[rt].pass / s.nodePass * 100).toFixed(1), pass: (rt) => m[rt].pass, nodePass: s.nodePass }; | ||
| }; | ||
| const deno = by("denoExclusions"), bun = by("bunUniverse"), full = by("fullCorpus"); | ||
| // major.minor from the measured binary, so a re-measure on a newer runtime | ||
| // also forces the hand-written 'Bun 1.4' / 'Deno 2.9' labels to move. | ||
| const mm = (rt) => version(rt).split(".").slice(0, 2).join("."); | ||
| const surfaces = [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The two surfaces listed here are the two that are currently correct. The two that actually drifted during this PR aren't covered: Technical details# The hand-copy gate covers 2 of 4 surfaces
## Affected sites
- `tests/cross-runtime/readme-table.mjs:97` — `surfaces` lists the homepage `COMPAT` array and the blog sentence only.
- `wiki/research/node-test-suite-leverage.md:161` — publishes `nub 98.5%, deno 74.2%, bun 70.1%` (`denoExclusions`), `98.2 / 71.7 / 71.8` (`bunUniverse`) and `97.4 / 68.1 / 65.6` (`fullCorpus`). Tracked and world-readable. Currently correct, ungated, and this PR had to hand-edit it after the re-measurement.
- `tests/cross-runtime/README.md:26` — `1 node, 1 nub, 4 bun, 2 deno and 0 node25` are `meta.retried.<rt>.flippedToPass`, hand-written prose. The same line's `99 files flipped to pass and none flipped to fail` is likewise hand-derived.
- `tests/cross-runtime/readme-table.mjs:88-92` — the explanatory comment states the same two-surface enumeration, so the code and the prose agree with each other but not with the repo.
## Required outcome
- Every surface carrying a figure derived from `results.json` is either asserted by `--check` or explicitly named as out of scope, so the next re-measurement has a complete checklist.
## Suggested approach (optional)
- `README.md:26`'s five counts are the cheapest to add: they are direct `meta.retried.<rt>.flippedToPass` reads, so one more `surfaces` entry pointing at `README` with a `/flipped (\d+) node, (\d+) nub/`-style pattern ends that flip-flop class.
- The wiki line spans three lenses rather than one, so it may be better served by dropping the per-runtime percentages and pointing at the README table — which is already generated — than by adding nine more assertions.
## Open questions for the human
- Is the wiki doc meant to carry standing figures at all, or is a pointer to the generated table the better long-term shape given it has now drifted twice? |
||
| { | ||
| file: path.join(HERE, "../../site/src/app/(home)/page.tsx"), | ||
| wants: [ | ||
| { re: /name: 'Nub', rate: ([\d.]+), tests: '([\d,]+) \/ ([\d,]+)'/, lens: deno, rt: "nub" }, | ||
| { re: /name: 'Deno [\d.]+', rate: ([\d.]+), tests: '([\d,]+) \/ ([\d,]+)'/, lens: deno, rt: "deno" }, | ||
| { re: /name: 'Bun [\d.]+', rate: ([\d.]+), tests: '([\d,]+) \/ ([\d,]+)'/, lens: deno, rt: "bun" }, | ||
|
pullfrog[bot] marked this conversation as resolved.
|
||
| { re: /name: 'Deno ([\d.]+)'/, value: mm("deno"), label: "Deno version label" }, | ||
| { re: /name: 'Bun ([\d.]+)'/, value: mm("bun"), label: "Bun version label" }, | ||
|
pullfrog[bot] marked this conversation as resolved.
|
||
| ], | ||
| }, | ||
| { | ||
| file: path.join(HERE, "../../site/content/blog/introducing-nub.mdx"), | ||
| wants: [ | ||
| { re: /clears ([\d.]+)% of what real Node passes/, lens: deno, rt: "nub" }, | ||
| { re: /([\d.]+)% for Deno/, lens: deno, rt: "deno" }, | ||
| { re: /([\d.]+)% for Bun/, lens: deno, rt: "bun" }, | ||
| { re: /for Deno (\d+\.\d+)/, value: mm("deno"), label: "Deno version label" }, | ||
| { re: /for Bun (\d+\.\d+)/, value: mm("bun"), label: "Bun version label" }, | ||
| ], | ||
| }, | ||
| { | ||
| file: path.join(HERE, "../../wiki/research/node-test-suite-leverage.md"), | ||
| wants: [ | ||
| { re: /skip list: nub ([\d.]+)%, deno ([\d.]+)%, bun ([\d.]+)%/, lens: deno, rts: ["nub", "deno", "bun"] }, | ||
| { re: /nothing skipped\): nub ([\d.]+)%, deno ([\d.]+)%, bun ([\d.]+)%/, lens: bun, rts: ["nub", "deno", "bun"] }, | ||
| { re: /wrappers: nub ([\d.]+)%, deno ([\d.]+)%, bun ([\d.]+)%/, lens: full, rts: ["nub", "deno", "bun"] }, | ||
| ], | ||
| }, | ||
| { | ||
| file: README, | ||
| wants: [ | ||
| { | ||
| re: /flipped (\d+) node, (\d+) nub, (\d+) bun, (\d+) deno and (\d+) node25 verdicts/, | ||
| counts: ["node", "nub", "bun", "deno", "node25"].map((rt) => String(results.meta.retried?.[rt]?.flippedToPass ?? "?")), | ||
| label: "retry-flip counts vs meta.retried", | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
| let bad = false; | ||
| for (const { file, wants } of surfaces) { | ||
| let src; | ||
| try { src = fs.readFileSync(file, "utf8"); } catch (e) { console.error(`cannot read ${file}: ${e.message}`); process.exit(2); } | ||
| for (const w of wants) { | ||
| const m = w.re.exec(src); | ||
| const name = w.label || w.rt || (w.rts || []).join("/"); | ||
| if (!m) { console.error(`${path.basename(file)}: pattern for ${name} not found (${w.re})`); bad = true; continue; } | ||
| if (w.value !== undefined) { | ||
| if (m[1] !== w.value) { console.error(`${path.basename(file)}: ${name} says ${m[1]}, measured binary is ${w.value}`); bad = true; } | ||
| continue; | ||
| } | ||
| const rts = w.counts ? [] : (w.rts || [w.rt]); | ||
| rts.forEach((rt, i) => { | ||
| const want = w.lens.rate(rt); | ||
| if (m[1 + i] !== want) { console.error(`${path.basename(file)}: ${rt} says ${m[1 + i]}, results.json says ${want}`); bad = true; } | ||
| }); | ||
| if (w.counts) { | ||
| w.counts.forEach((want, i) => { | ||
| if (m[1 + i] !== want) { console.error(`${path.basename(file)}: ${name} — position ${i + 1} says ${m[1 + i]}, meta.retried says ${want}`); bad = true; } | ||
| }); | ||
| } | ||
| if (w.rt && m[2] && (m[2] !== n(w.lens.pass(w.rt)) || m[3] !== n(w.lens.nodePass))) { | ||
| console.error(`${path.basename(file)}: ${w.rt} tests say ${m[2]} / ${m[3]}, results.json says ${n(w.lens.pass(w.rt))} / ${n(w.lens.nodePass)}`); | ||
| bad = true; | ||
| } | ||
| } | ||
| } | ||
| return bad; | ||
| } | ||
|
|
||
| if (process.argv.includes("--check")) { | ||
| if (checkHandCopies()) drifted = true; | ||
| if (drifted) process.exit(1); | ||
| console.log("README tables match results.json"); | ||
| console.log("README tables and site figures match results.json"); | ||
| } else if (process.argv.includes("--write")) { | ||
| fs.writeFileSync(README, readme); | ||
| console.log("README tables rewritten"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this sentence predates both label rounds. It describes
--checkas comparing the two site surfaces' rates plus the wiki lens figures and the retry sentence, but the check now also asserts the Bun/Deno version labels (c95ec26b) and, in this commit, the Node corpus labels, the Node row counts and the miss count. Worth restating so the paragraph stays the complete checklist it is meant to be.