test: update modrinth tests
This commit is contained in:
parent
9359f0c20a
commit
ae37c8fd5e
2 changed files with 64 additions and 49 deletions
|
|
@ -1,5 +1,11 @@
|
|||
import { test } from "vitest";
|
||||
import { Instance, offlineAuth, RuntimeManager, getJavaComponent, importModrinthModpack } from "../../dist/index.js";
|
||||
import {
|
||||
Instance,
|
||||
offlineAuth,
|
||||
RuntimeManager,
|
||||
getJavaComponent,
|
||||
importModrinthModpack,
|
||||
} from "../../dist/index.js";
|
||||
import path from "path";
|
||||
import fs from "fs/promises";
|
||||
|
||||
|
|
@ -8,23 +14,29 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp");
|
|||
// await fs.mkdir(gameRoot, { recursive: true });
|
||||
|
||||
test("launch game", { timeout: 0, tags: ["modrinth"] }, async () => {
|
||||
const modpack = await importModrinthModpack(
|
||||
"${modpack_url}",
|
||||
);
|
||||
|
||||
const javaManager = new RuntimeManager(path.join(gameRoot, "java"));
|
||||
javaManager.on("progress", console.log)
|
||||
// const java = await javaManager.use(await getJavaComponent("${version}"))
|
||||
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", "${modpack_id}") },
|
||||
javaExecutable: "${java}",
|
||||
ram: { max: "4G", min: "4G" }
|
||||
paths: {
|
||||
root: gameRoot,
|
||||
instance: path.join(gameRoot, "instances", "${modpack_id}"),
|
||||
},
|
||||
await importModrinthModpack("${modpack_url}", "url")
|
||||
);
|
||||
javaExecutable: "${java}",
|
||||
ram: { max: "4G", min: "4G" },
|
||||
modrinth: modpack,
|
||||
});
|
||||
|
||||
instance.on("progress", console.log);
|
||||
instance.on("log", (step, msg) => {
|
||||
console.log(`[${step}] ${msg}`)
|
||||
})
|
||||
console.log(`[${step}] ${msg}`);
|
||||
});
|
||||
|
||||
await instance.install();
|
||||
const p = await instance.launch();
|
||||
|
|
|
|||
|
|
@ -8,26 +8,29 @@ const gameRoot = path.join(import.meta.dirname, "..", "temp");
|
|||
// await fs.mkdir(gameRoot, { recursive: true });
|
||||
|
||||
test("launch game", { timeout: 0, tags: ["modrinth"] }, async () => {
|
||||
const javaManager = new RuntimeManager(path.join(gameRoot, "java"));
|
||||
javaManager.on("progress", console.log)
|
||||
const modpack =
|
||||
await importModrinthModpack("${modpack_url}", "url")
|
||||
const java = await javaManager.use(await getJavaComponent(modpack.version))
|
||||
const modpack = await importModrinthModpack(
|
||||
"${modpack_url}",
|
||||
);
|
||||
|
||||
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", "${modpack_id}") },
|
||||
javaExecutable: java,
|
||||
ram: { max: "4G", min: "4G" }
|
||||
paths: {
|
||||
root: gameRoot,
|
||||
instance: path.join(gameRoot, "instances", "${modpack_id}"),
|
||||
},
|
||||
modpack
|
||||
);
|
||||
javaExecutable: java,
|
||||
ram: { max: "4G", min: "4G" },
|
||||
modrinth: modpack,
|
||||
});
|
||||
|
||||
instance.on("progress", console.log);
|
||||
instance.on("log", (step, msg) => {
|
||||
console.log(`[${step}] ${msg}`)
|
||||
})
|
||||
console.log(`[${step}] ${msg}`);
|
||||
});
|
||||
|
||||
await instance.install();
|
||||
const p = await instance.launch();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue