Yuku

Testing

Yuku is checked against the specs and against independent tools on tens of thousands of files: the parser against Test262 and Oxc’s ASTs, the analyzer against the TypeScript checker and typescript-eslint, the printer against its own output and the Zig printer. Every suite runs on Linux, macOS, and Windows on every commit, and every one passes in full.

SuiteChecked againstCheckedResult
ParserTest262, TypeScript, Babel, Oxc57,538 testsAll pass
Semantic analysisThe TypeScript checker, scope-manager21,998,189 comparisonsAll agree
CodegenReparsing its output, the Zig printer684,345 checksAll pass
Source mapsThe original source54,715 filesAll trace back
FuzzingCrashes and out-of-memory3,000,000 inputs a runNo crash

The counts are from December 2026, and grow as the suite syncs with upstream.

The corpus

parser-test-suite collects the tests of Test262, the TypeScript compiler, and Babel, synced with upstream daily.

Languagepassfailsemantic
JavaScript38,9775,2674,200
TypeScript8,687291
JSX88253

Twelve real codebases, each pinned to a commit, add 6,953 files of production code: the TypeScript compiler, Node.js, Vue, Svelte, Preact, three.js, Zod, date-fns, Excalidraw, NestJS, webpack, and Vite. Analysis and codegen run over all 54,715 passing and codebase files.

Parser

CategoryExpectation
passParses with no diagnostics, and the AST matches a snapshot exactly
failProduces a syntax error
semanticParses, then fails semantic analysis with an early error

The snapshots come from an independent parser, Oxc, and must match down to every field, position, and comment. Passing files must also walk in source order and analyze without a false positive. The suite runs through the yuku package built from local source, so it checks the whole chain from the Zig parser to the JavaScript AST. Another 283 fixtures of Yuku’s own pin down diagnostics and AST shapes.

Semantic analysis

Every one of the 54,715 files is analyzed and compared with independent tools.

Compared withMust agree onAgreed
The TypeScript checkerThe declaration every reference resolves to, values and types alike3,094,649
TypeScript’s syntax tree and symbolsEvery import and export record, and the flags of every binding12,626,106
TypeScript’s emitWhich imports are removed as type-only, in 12,996 files30,549
scope-managerEvery runtime reference and write, every declaration and its scope6,164,515
TypeScript programsEvery import, re-export, exported name, and relative path82,370

The last row links each codebase as one project, across files. Where the reference tool is the one that differs, such as tsc resolving a require binding to the wrong block, the difference is listed by file with its reason, 16 reasons in all, and the suite fails if one changes or a new one appears.

Each file’s model must also be consistent with itself: every lookup agrees with resolution, every binding and reference maps back to its node, parents agree with the walk, every export has its record, analysis is deterministic, and reanalyze() leaves the model unchanged.

Codegen

Every one of the 54,715 files is printed pretty, compact, and minified, from a parse without parentheses, so the printer must rebuild every one that precedence needs.

  • The output parses with no diagnostics.
  • Pretty and compact output parse back to the same AST.
  • No comment is lost or duplicated.
  • Printing the output again gives the same code.

The JavaScript print encodes a tree back for the Zig printer, and must agree with printing the parsed tree byte for byte, source maps included: 57,800 inputs under 9 option sets, 520,200 comparisons.

Source maps

For every one of the 54,715 files, every identifier in the output must map back to its original name and position.

Platforms

The packed npm package is installed and run on macOS, Linux, and Windows, each on arm64 and x64, and on Linux with musl, natively and as WebAssembly. It also runs on the oldest Node.js it supports.

Fuzzing

A fuzzer throws 3,000,000 mutated inputs at the parser in every language mode, and parses and analyzes every 20,000th input again with each of its allocations failing in turn. The parser must never crash, and any failure dumps a self-contained reproducer. With everything in one arena, a parse has nothing to leak even when memory runs out.

Running the suites

bun run test

See CONTRIBUTING.md to run one suite or add cases.