-
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 all 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,107 @@ 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 corpusMM = String(results.meta.corpusNodeVersion || "?").split(".").slice(0, 2).join("."); | ||
| const nubMisses = String(deno.nodePass - deno.pass("nub")); | ||
| const surfaces = [ | ||
| { | ||
| 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.
|
||
| { re: /name: 'Node ([\d.]+)'/, value: corpusMM, label: "Node corpus label" }, | ||
|
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.
Technical details# The page.tsx prose corpus label is still ungated
## Affected sites
- `site/src/app/(home)/page.tsx:1007` — `Node 26.7’s own test suite under Deno’s
compatibility lens`. Equals `meta.corpusNodeVersion` major.minor, the same quantity `corpusMM`
already computes.
- `tests/cross-runtime/readme-table.mjs:115` — `/name: 'Node ([\d.]+)'/` anchors on the COMPAT
array at page.tsx:955, so it cannot reach line 1007.
- `site/content/blog/introducing-nub.mdx:36` — the analogous prose sentence IS gated by the new
`/On Node (\d+\.\d+)'s own test suite/` want, which is what makes the page.tsx omission stand out.
## Required outcome
- A corpus label on page.tsx that disagrees with `meta.corpusNodeVersion` fails `--check`, wherever
on the page it appears.
## Suggested approach (optional)
- One more want on the surface the gate already reads:
`{ re: /Node ([\d.]+)’s own test suite/, value: corpusMM, label: "Node corpus label (prose)" }`.
Note the label then appears twice in the file, so if these two ever need to differ the patterns
must stay distinct — today both should read `26.7`. |
||
| { re: /name: 'Node [\d.]+', rate: 100, tests: '([\d,]+) \/ ([\d,]+)'/, values: [n(deno.nodePass), n(deno.nodePass)], label: "Node row counts" }, | ||
| { re: /Most of Nub’s (\d+) misses/, value: nubMisses, label: "Nub miss count" }, | ||
| { re: /Node (\d+\.\d+)’s own test suite/, value: corpusMM, label: "Node corpus label (prose)" }, | ||
| ], | ||
| }, | ||
| { | ||
| 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" }, | ||
| { re: /On Node (\d+\.\d+)'s own test suite/, value: corpusMM, label: "Node corpus 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 || w.values) { | ||
| const list = w.values || [w.value]; | ||
| list.forEach((want, i) => { | ||
| if (m[1 + i] !== want) { console.error(`${path.basename(file)}: ${name} says ${m[1 + i]}, results.json says ${want}`); 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.
The two surfaces listed here are the two that are currently correct. The two that actually drifted during this PR aren't covered:
wiki/research/node-test-suite-leverage.md:161carries the same threedenoExclusionsrates (plus six more frombunUniverse/fullCorpus) and went stale across two review rounds before50bdd37fixed it, andREADME.md:26's retry-flip counts went4 → 1 → 4across three commits. Neither is reachable by theBLOCKSloop, which only covers the marker-delimited tables.Technical details