Add option to throw on non-empty RCON responses

Add option to FactorioServer.sendRcon to throw on non-empty responses
from Factorio.  This is useful for detecting errors returned by commands
that should not have a response.
This commit is contained in:
Hornwitser committed 2020-01-04 17:34:16 +01:00
1 parent f88e1f1d3a
commit 221dc855f4
3 files changed
+17 -3

No files matched your search

+7
View File
@@ -129,6 +129,13 @@ describe("Integration of lib/factorio/server", function() {
let result = await server.sendRcon("/sc rcon.print('success')");
assert.equal(result, 'success\n');
});
it("throws on non-empty response when enabled", async function() {
slowTest(this);
await assert.rejects(
server.sendRcon("/sc rcon.print('fail')", true),
new Error('Expected empty response but got "fail\n"')
);
});
});
describe(".stop()", function() {