build(deps): upgrade web to SvelteKit 3 and vitest 5

Move the SvelteKit config into vite.config.js, replace the $lib alias with
#lib subpath imports (dropping the vitest alias), extend $app/tsconfig, and
pass asset() paths without a leading slash. Drop the @babel/core and js-yaml
overrides, which no longer match anything in the tree.
This commit is contained in:
tiennm99 committed 2026-10-03 13:12:03 +07:00
1 parent 3c622d7efb
commit 3584d897c1
16 files changed
+141 -266

No files matched your search

+5 -4
View File
@@ -1,11 +1,12 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getChampionImageUrl, getTodaySeed } from "$lib/champion-data";
import { getChampionImageUrl, getTodaySeed } from "#lib/champion-data.js";
import { AATROX, CHAMPIONS } from "./fixtures/champions";
// $app/paths is a SvelteKit build-time construct with no meaning to a bare
// Vitest run. Base-path behaviour is verified by the production preview check,
// not here, so the identity stub is the honest unit-test substitute.
vi.mock("$app/paths", () => ({ asset: (p) => p }));
// not here, so the stub mirrors asset() with an empty base: it takes a path
// without a leading slash and returns it root-relative.
vi.mock("$app/paths", () => ({ asset: (p) => `/${p}` }));
/**
* `champions` is module-private with no reset export, so each group gets a fresh
@@ -19,7 +20,7 @@ async function freshModule({ champions = CHAMPIONS, ok = true, status = 200 } =
json: async () => champions,
}));
vi.stubGlobal("fetch", fetchMock);
const mod = await import("$lib/champion-data");
const mod = await import("#lib/champion-data.js");
return { mod, fetchMock };
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { CLASSIC_ATTRIBUTES, compareChampions } from "$lib/classic-mode";
import { CLASSIC_ATTRIBUTES, compareChampions } from "#lib/classic-mode.js";
import { AATROX, AHRI, AKALI, BELVETH } from "./fixtures/champions";
/** Pull one attribute's comparison out of the 7-entry result array. */
+1 -1
View File
@@ -7,7 +7,7 @@ import {
loadUnlimitedStats,
saveUnlimitedStats,
submitGuess,
} from "$lib/game-engine";
} from "#lib/game-engine.js";
import { AATROX, AHRI } from "./fixtures/champions";
/** Minimal stand-in for compareChampions — the engine only stores what this returns. */