Files
oxc-project__oxc/packages/codegen/test/test262.test.ts
camc314 fc4e18edf9 refactor(codegen): use it.for for generated tests (#25874)
## Summary
- replace manual test-registration loops with Vitest parameterized APIs
- preserve per-fixture skip behavior with `.for` and parameterized suite options
- retain imperative loops that exercise fixture contents rather than register tests
2026-08-18 15:38:24 +00:00

23 lines
918 B
TypeScript

// Test262 conformance.
//
// Tests this package prints every Test262 fixture exactly as Rust `oxc_codegen` prints it.
import { readdir, readFile } from "node:fs/promises";
import { join as pathJoin } from "node:path";
import { describe, it } from "vitest";
import { checkFixture, TEST262_DIR_PATH, test262SourceType } from "./utils/common.ts";
// Test262 keeps its fixtures' shared helpers in `harness`, which are not test cases
const fixturePaths = (await readdir(TEST262_DIR_PATH, { recursive: true }))
.filter((path) => path.endsWith(".js") && !path.startsWith("harness/"))
.sort();
describe.concurrent("test262", () => {
// oxlint-disable-next-line vitest/expect-expect
it.for(fixturePaths)("%s", async (path, ctx) => {
const sourceText = await readFile(pathJoin(TEST262_DIR_PATH, path), "utf8");
if (!checkFixture(path, sourceText, "js", test262SourceType(sourceText))) ctx.skip();
});
});