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
+19 -9

No files matched your search

+9 -3
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 { GameWorld } from "../src/game/world/world";
@@ -22,7 +22,10 @@ const NEW_BARK_TOWN = "24:4",
describe.skipIf(!existsSync(romPath) || !existsSync(`${pret}/data/maps/landmarks.asm`))(
"the atlas data against the pinned PRET source",
() => {
const assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
let assets!: CrystalAssets;
beforeAll(() => {
assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
});
const read = (path: string) => readFileSync(`${pret}/${path}`, "utf8");
// const_def counts from 0, or from the value given.
const constants = (path: string, prefix: string) => {
@@ -59,7 +62,10 @@ describe.skipIf(!existsSync(romPath) || !existsSync(`${pret}/data/maps/landmarks
);
describe.skipIf(!existsSync(romPath))("the region atlas", () => {
const assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
let assets!: CrystalAssets;
beforeAll(() => {
assets = new CrystalAssets(new Uint8Array(readFileSync(romPath)));
});
function fixture(visited: number[]) {
const world = new GameWorld(assets, () => new Date("2026-09-25T12:00:00"), () => 0x42);
world.state.party = [
+10 -6
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");
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.
const species = new Map(
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(