diff --git a/package.json b/package.json index 1e3c014b..468452c0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "build": "tsc --build", "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", "fast-test": "FAST_TEST=y pnpm test", "cover": "nyc pnpm test", diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js index 0c4fba15..13b5669f 100644 --- a/test/integration/clusterio.js +++ b/test/integration/clusterio.js @@ -13,7 +13,7 @@ const { wait } = lib; const testStrings = require("../lib/factorio/test_strings"); const { TestControl, TestControlConnector, url, controlToken, slowTest, - exec, execCtl, sendRcon, getControl, spawn, instancesDir, factorioDir, + exec, execCtl, sendRcon, getControl, spawnNode, instancesDir, factorioDir, } = require("./index"); @@ -29,7 +29,7 @@ async function checkInstanceStatus(id, status) { } 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() { diff --git a/test/integration/index.js b/test/integration/index.js index b9289881..5a2be83e 100644 --- a/test/integration/index.js +++ b/test/integration/index.js @@ -179,7 +179,7 @@ async function exec(command, options = {}) { } 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); } @@ -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() { this.timeout(40000); @@ -302,7 +306,7 @@ before(async function() { 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"); - 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"); @@ -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.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 controlConnector = new TestControlConnector(url, 2, tlsCa); @@ -366,6 +370,7 @@ module.exports = { sendRcon, getControl, spawn, + spawnNode, url, controlToken,