Enable source maps in tests

This commit is contained in:
Cooldude2606 authored and Daniel committed 2024-11-21 08:25:23 -08:00
1 parent 069f568941
commit 1556c0afdd
3 files changed
+11 -6

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@
"scripts": { "scripts": {
"build": "tsc --build", "build": "tsc --build",
"watch": "tsc --build --watch", "watch": "tsc --build --watch",
"test": "pnpm run build && mocha --check-leaks -R spec --recursive test \"plugins/*/test/**\" --exclude \"test/manual/**\"", "test": "pnpm run build && mocha --enable-source-maps --check-leaks -R spec --recursive test \"plugins/*/test/**\" --exclude \"test/manual/**\"",
"silent-test": "SILENT_TEST=y pnpm test", "silent-test": "SILENT_TEST=y pnpm test",
"fast-test": "FAST_TEST=y pnpm test", "fast-test": "FAST_TEST=y pnpm test",
"cover": "nyc pnpm test", "cover": "nyc pnpm test",
+2 -2
View File
@@ -13,7 +13,7 @@ const { wait } = lib;
const testStrings = require("../lib/factorio/test_strings"); const testStrings = require("../lib/factorio/test_strings");
const { const {
TestControl, TestControlConnector, url, controlToken, slowTest, TestControl, TestControlConnector, url, controlToken, slowTest,
exec, execCtl, sendRcon, getControl, spawn, instancesDir, factorioDir, exec, execCtl, sendRcon, getControl, spawnNode, instancesDir, factorioDir,
} = require("./index"); } = require("./index");
@@ -29,7 +29,7 @@ async function checkInstanceStatus(id, status) {
} }
async function spawnAltHost(config = "alt-host-config.json") { async function spawnAltHost(config = "alt-host-config.json") {
return await spawn("alt-host:", `node ../../packages/host run --config ${config}`, /Started host/); return await spawnNode("alt-host:", `../../packages/host run --config ${config}`, /Started host/);
} }
async function startAltHost() { async function startAltHost() {
+8 -3
View File
@@ -179,7 +179,7 @@ async function exec(command, options = {}) {
} }
async function execCtl(...args) { async function execCtl(...args) {
args[0] = `node ../../packages/ctl ${args[0]}`; args[0] = `node --enable-source-maps ../../packages/ctl ${args[0]}`;
return await exec(...args); return await exec(...args);
} }
@@ -221,6 +221,10 @@ function spawn(name, cmd, waitFor) {
}); });
} }
async function spawnNode(name, cmd, waitFor) {
return await spawn(name, `node --enable-source-maps ${cmd}`, waitFor);
}
before(async function() { before(async function() {
this.timeout(40000); this.timeout(40000);
@@ -302,7 +306,7 @@ before(async function() {
await exec("node ../../packages/controller bootstrap create-ctl-config test"); await exec("node ../../packages/controller bootstrap create-ctl-config test");
await exec("node ../../packages/ctl control-config set control.tls_ca ../../test/file/tls/cert.pem"); await exec("node ../../packages/ctl control-config set control.tls_ca ../../test/file/tls/cert.pem");
controllerProcess = await spawn("controller:", "node ../../packages/controller run", /Started controller/); controllerProcess = await spawnNode("controller:", "../../packages/controller run", /Started controller/);
await execCtl("host create-config --id 4 --name host --generate-token"); await execCtl("host create-config --id 4 --name host --generate-token");
@@ -310,7 +314,7 @@ before(async function() {
await exec(`node ../../packages/host config set host.factorio_directory ${relativeFactorioDir}`); await exec(`node ../../packages/host config set host.factorio_directory ${relativeFactorioDir}`);
await exec("node ../../packages/host config set host.tls_ca ../../test/file/tls/cert.pem"); await exec("node ../../packages/host config set host.tls_ca ../../test/file/tls/cert.pem");
hostProcess = await spawn("host:", "node ../../packages/host run", /Started host/); hostProcess = await spawnNode("host:", "../../packages/host run", /Started host/);
let tlsCa = await fs.readFile("test/file/tls/cert.pem"); let tlsCa = await fs.readFile("test/file/tls/cert.pem");
let controlConnector = new TestControlConnector(url, 2, tlsCa); let controlConnector = new TestControlConnector(url, 2, tlsCa);
@@ -366,6 +370,7 @@ module.exports = {
sendRcon, sendRcon,
getControl, getControl,
spawn, spawn,
spawnNode,
url, url,
controlToken, controlToken,