Fix Turbopack module resolution for lzma and restore path imports

This commit is contained in:
openhands committed 2026-08-25 22:19:59 +02:00
1 parent a5044c80d7
commit e06596391e
35 files changed
+392 -333

No files matched your search

+8 -6
View File
@@ -1,8 +1,8 @@
// @vitest-environment node
import { promises as fs } from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getRuntimePath } from "@/lib/utils/runtime-path";
const { getGamedataRootMock, getNitroFilesRootMock, settingGetMock } =
vi.hoisted(() => ({
@@ -26,13 +26,15 @@ describe("writeFurniData production mirror", () => {
let tempDir: string;
beforeEach(async () => {
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "furni-data-paths-"));
tempDir = await fs.mkdtemp(
getRuntimePath(os.tmpdir(), "furni-data-paths-"),
);
getNitroFilesRootMock.mockResolvedValue("");
getGamedataRootMock.mockResolvedValue(path.join(tempDir, "Gamedata"));
getGamedataRootMock.mockResolvedValue(getRuntimePath(tempDir, "Gamedata"));
settingGetMock.mockImplementation(
async (key: string, fallback: string | null = null) => {
if (key === "furni_data_url") {
return path.join(tempDir, "cms", "FurnitureData.json");
return getRuntimePath(tempDir, "cms", "FurnitureData.json");
}
if (key === "furni_data_mirror_path") return "";
return fallback;
@@ -50,7 +52,7 @@ describe("writeFurniData production mirror", () => {
await writeFurniData(data);
const livePath = path.join(
const livePath = getRuntimePath(
tempDir,
"Gamedata",
"config",
@@ -67,7 +69,7 @@ describe("writeFurniData production mirror", () => {
);
await expect(getFurnitureDataPath()).resolves.toBe(
path.join(tempDir, "Gamedata", "config", "FurnitureData.json"),
getRuntimePath(tempDir, "Gamedata", "config", "FurnitureData.json"),
);
});
});