diff --git a/.gitignore b/.gitignore index f2b6f60..fd83c16 100644 --- a/.gitignore +++ b/.gitignore @@ -143,6 +143,7 @@ vite.config.ts.timestamp-* # Test temp folder tests/temp tests/vanilla/* +tests/modrinth/* tests/modloaders/forge/* tests/modloaders/neoforge/* tests/modloaders/fabric/* diff --git a/tests/modloader-java.test.ts.template b/tests/modloader-java.test.ts.template index 665aedf..c4a3e95 100644 --- a/tests/modloader-java.test.ts.template +++ b/tests/modloader-java.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "modloader"] }, async () => { +test("launch game", { timeout: 0, tags: ["${modloader}"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) // const java = await javaManager.use(await getJavaComponent("${version}")) diff --git a/tests/modloader.test.ts.template b/tests/modloader.test.ts.template index e3e36d5..b87fa1b 100644 --- a/tests/modloader.test.ts.template +++ b/tests/modloader.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "modloader"] }, async () => { +test("launch game", { timeout: 0, tags: ["${modloader}"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) const java = await javaManager.use(await getJavaComponent("${version}")) diff --git a/tests/modrinth-java.test.ts.template b/tests/modrinth-java.test.ts.template index 850082a..add2bc0 100644 --- a/tests/modrinth-java.test.ts.template +++ b/tests/modrinth-java.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "modrinth"] }, async () => { +test("launch game", { timeout: 0, tags: ["modrinth"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) // const java = await javaManager.use(await getJavaComponent("${version}")) diff --git a/tests/modrinth.test.ts.template b/tests/modrinth.test.ts.template index ea26988..217109c 100644 --- a/tests/modrinth.test.ts.template +++ b/tests/modrinth.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "modrinth"] }, async () => { +test("launch game", { timeout: 0, tags: ["modrinth"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) const modpack = diff --git a/tests/modrinth/modrinth-Better%20MC%20%5BFORGE%5D%20BMC4%20v43.test.ts b/tests/modrinth/modrinth-Better%20MC%20%5BFORGE%5D%20BMC4%20v43.test.ts deleted file mode 100644 index f57345e..0000000 --- a/tests/modrinth/modrinth-Better%20MC%20%5BFORGE%5D%20BMC4%20v43.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { test } from "vitest"; -import { Instance, offlineAuth, RuntimeManager, getJavaComponent, importModrinthModpack } from "../../dist/index.js"; -import path from "path"; -import fs from "fs/promises"; - -const gameRoot = path.join(import.meta.dirname, "..", "temp"); -// await fs.rm(gameRoot, { recursive: true, force: true }); -// await fs.mkdir(gameRoot, { recursive: true }); - -test("launch game", { timeout: 0, tags: ["full", "modrinth"] }, async () => { - const javaManager = new RuntimeManager(path.join(gameRoot, "java")); - javaManager.on("progress", console.log) - // const java = await javaManager.use(await getJavaComponent("${version}")) - - const instance = new Instance({ - auth: offlineAuth("player"), - paths: { root: gameRoot, instance: path.join(gameRoot, "instances", "Better%20MC%20%5BFORGE%5D%20BMC4%20v43") }, - javaExecutable: "/nix/store/wrf2p3qb5sycka2y4nnl7pdm8h6zpcin-openjdk-21.0.10+7/bin/java", - ram: {max:"4G",min:"4G"} - }, - await importModrinthModpack("https://cdn.modrinth.com/data/4BV47HRn/versions/krFPoaLH/Better%20MC%20%5BFORGE%5D%20BMC4%20v43.mrpack", "url") - ); - - instance.on("progress", console.log); - instance.on("log", (step, msg) => { - console.log(`[${step}] ${msg}`) - }) - - await instance.install(); - const p = await instance.launch(); - - p.stdout.on("data", (d: Buffer) => { - console.log(d.toString()); - }); - - p.stderr.on("data", (d: Buffer) => { - console.log(d.toString()); - }); - - await new Promise((res) => { - p.on("error", (d: Buffer) => { - console.log(d.toString()); - res(); - }); - p.on("close", () => { - console.log("closed"); - res(); - }); - }); -}); diff --git a/tests/modrinth/modrinth-Fabulously.Optimized-v12.0.7.test.ts b/tests/modrinth/modrinth-Fabulously.Optimized-v12.0.7.test.ts deleted file mode 100644 index 3a96bc0..0000000 --- a/tests/modrinth/modrinth-Fabulously.Optimized-v12.0.7.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { test } from "vitest"; -import { Instance, offlineAuth, RuntimeManager, getJavaComponent, importModrinthModpack } from "../../dist/index.js"; -import path from "path"; -import fs from "fs/promises"; - -const gameRoot = path.join(import.meta.dirname, "..", "temp"); -// await fs.rm(gameRoot, { recursive: true, force: true }); -// await fs.mkdir(gameRoot, { recursive: true }); - -test("launch game", { timeout: 0, tags: ["full", "modrinth"] }, async () => { - const javaManager = new RuntimeManager(path.join(gameRoot, "java")); - javaManager.on("progress", console.log) - // const java = await javaManager.use(await getJavaComponent("${version}")) - - const instance = new Instance({ - auth: offlineAuth("player"), - paths: { root: gameRoot, instance: path.join(gameRoot, "instances", "Fabulously.Optimized-v12.0.7") }, - javaExecutable: "/nix/store/wrf2p3qb5sycka2y4nnl7pdm8h6zpcin-openjdk-21.0.10+7/bin/java", - ram: {max:"4G",min:"4G"} - }, - await importModrinthModpack("/home/heroz/Downloads/Fabulously.Optimized-v12.0.7.mrpack", "file") - ); - - instance.on("progress", console.log); - instance.on("log", (step, msg) => { - console.log(`[${step}] ${msg}`) - }) - - await instance.install(); - const p = await instance.launch(); - - p.stdout.on("data", (d: Buffer) => { - console.log(d.toString()); - }); - - p.stderr.on("data", (d: Buffer) => { - console.log(d.toString()); - }); - - await new Promise((res) => { - p.on("error", (d: Buffer) => { - console.log(d.toString()); - res(); - }); - p.on("close", () => { - console.log("closed"); - res(); - }); - }); -}); diff --git a/tests/vanilla-java.test.ts.template b/tests/vanilla-java.test.ts.template index ad10e49..95560e9 100644 --- a/tests/vanilla-java.test.ts.template +++ b/tests/vanilla-java.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "vanilla"] }, async () => { +test("launch game", { timeout: 0, tags: ["vanilla"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) // const java = await javaManager.use(await getJavaComponent("${version}")) diff --git a/tests/vanilla.test.ts.template b/tests/vanilla.test.ts.template index 4f23338..c2f61b7 100644 --- a/tests/vanilla.test.ts.template +++ b/tests/vanilla.test.ts.template @@ -7,7 +7,7 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp"); // await fs.rm(gameRoot, { recursive: true, force: true }); // await fs.mkdir(gameRoot, { recursive: true }); -test("launch game", { timeout: 0, tags: ["full", "vanilla"] }, async () => { +test("launch game", { timeout: 0, tags: ["vanilla"] }, async () => { const javaManager = new RuntimeManager(path.join(gameRoot, "java")); javaManager.on("progress", console.log) const java = await javaManager.use(await getJavaComponent("${version}")) diff --git a/vitest.config.ts b/vitest.config.ts index 880f433..ee8d3a5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,24 +4,29 @@ export default defineConfig({ test: { fileParallelism: false, tags: [ - { - name: 'full', - description: 'Full test suite', - concurrent: false - }, { name: 'vanilla', - description: 'Only vanilla tests from full test suite', + description: 'Only vanilla tests', concurrent: false }, { name: 'forge', - description: 'Only forge and neoforge tests from full test suite', + description: 'Only forge tests', + concurrent: false + }, + { + name: 'neoforge', + description: 'Only neoforge tests', + concurrent: false + }, + { + name: 'fabric', + description: 'Only fabric tests', concurrent: false }, { name: 'modrinth', - description: 'Only tests that uses populars modrinth modpacks', + description: 'Only tests with populars modrinth modpacks', concurrent: false } ],