fix: force os to linux in tests

This commit is contained in:
HerozDotExe 2025-10-06 17:19:20 +02:00
parent d6a9bae48d
commit b9ea3c81c6
3 changed files with 12 additions and 3 deletions

View file

@ -1,4 +1,4 @@
import { expect, test } from "vitest";
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import path from "path";
import fs from "fs/promises";
@ -16,6 +16,9 @@ async function exists(path: string) {
}
}
// mock os to linux for testing
vi.stubGlobal("process", { platform: "linux" });
test("install java-runtime-beta for linux correctly", {timeout: 10000}, async () => {
await nlk.core.java.download("linux", "java-runtime-beta", javaPath);

View file

@ -1,4 +1,4 @@
import { expect, test } from "vitest";
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import path from "path";
import fs from "fs/promises";
@ -16,6 +16,9 @@ async function exists(path: string) {
}
}
// mock os to linux for testing
vi.stubGlobal("process", { platform: "linux" });
test(
"download libraries for 1.21.8 correctly",
{ timeout: 10000 },

View file

@ -1,4 +1,4 @@
import { expect, test } from "vitest";
import { expect, test, vi } from "vitest";
import * as nlk from "../dist/index.js";
import path from "path";
import fs from "fs/promises";
@ -16,6 +16,9 @@ async function exists(path: string) {
}
}
// mock os to linux for testing
vi.stubGlobal("process", { platform: "linux" });
// old version because newer versions doesn't have natives
test("download natives for 1.15 correctly", { timeout: 10000 }, async () => {
const versionManifest = await nlk.core.version.getVersionManifest("1.15");