Load the atlas and Pokédex test data only when the suite runs (#66)

describe.skipIf still runs the describe body to collect tests, so the
ROM and PRET reads at describe level failed the synthetic CI job without
a ROM (runs 123–133). The reads now happen in beforeAll, as in the other
ROM suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kawaandClaude Opus 5.5 committed 2026-10-05 09:53:10 +02:00
1 parent 7afc87d898
commit 0d8ff442ce
2 files changed
+24 -14

No files matched your search

+15 -11
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { beforeAll, describe, expect, it } from "vitest";
import { existsSync, readFileSync } from "node:fs";
import { CrystalAssets } from "../src/game/rom/assets";
import { dexHeight, dexWeight } from "../src/game/rom/pokedex";
@@ -39,8 +39,10 @@ describe("the Pokédex number formats", () => {
});
describe.skipIf(!existsSync(romPath))("the Pokédex data", () => {
const assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
const dex = assets.pokedex;
let dex!: CrystalAssets["pokedex"];
beforeAll(() => {
dex = new CrystalAssets(new Uint8Array(readFileSync(romPath))).pokedex;
});
it("reads its strings and the New mode order", () => {
expect(dex.dexString("String_SEEN")).toBe("SEEN");
@@ -76,15 +78,17 @@ describe.skipIf(!existsSync(romPath))("the Pokédex data", () => {
describe.skipIf(!existsSync(romPath) || !existsSync(`${pret}/data/pokemon/dex_order_new.asm`))(
"the Pokédex data against the pinned PRET source",
() => {
const assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
const dex = assets.pokedex;
const read = (path: string) => readFileSync(`${pret}/${path}`, "utf8");
// constants/pokemon_constants.asm numbers species from 1.
const species = new Map(
[...read("constants/pokemon_constants.asm").matchAll(/^\s+const (\w+)/gm)].map(
([, name], index) => [name, index + 1],
),
);
let dex!: CrystalAssets["pokedex"], species!: Map<string, number>;
beforeAll(() => {
dex = new CrystalAssets(new Uint8Array(readFileSync(romPath))).pokedex;
// constants/pokemon_constants.asm numbers species from 1.
species = new Map(
[...read("constants/pokemon_constants.asm").matchAll(/^\s+const (\w+)/gm)].map(
([, name], index) => [name, index + 1],
),
);
});
it("matches NewPokedexOrder", () => {
const order = [...read("data/pokemon/dex_order_new.asm").matchAll(/^\s+db (\w+)/gm)].map(