Cover ctl output code that only ran in child processes

CI coverage does not measure the ctl processes the integration tests start, so cover the Ctl log and debug event handlers, start-all, stop-all and pickFields with unit tests, and run mod show, user list flags, parse-exchange-string and log follow in process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-11-19 16:14:58 +00:00
1 parent f49c633e77
commit f52821d1cd
4 files changed
+170 -1

No files matched your search

+15
View File
@@ -2122,6 +2122,7 @@ describe("Integration of Clusterio", function() {
describe("mod show", function() {
it("gives details of a mod", async function() {
assert.match(await execCtlOutput("mod show empty_mod 1.0.0"), /name: empty_mod/);
let result = await execCtlProcess("mod show empty_mod 1.0.0");
let hash = await lib.hashFile(path.join("temp", "test", "mods", "empty_mod_1.0.0.zip"));
let stat = await fs.stat(path.join("temp", "test", "mods", "empty_mod_1.0.0.zip"));
@@ -2396,6 +2397,20 @@ describe("Integration of Clusterio", function() {
const output = await execCtlOutput("user show test --instance-stats");
assert.match(output, /name +\| test/);
});
it("prints the result of human mode commands with more options", async function() {
assert.match(await execCtlOutput("user list --stats --attributes"), /isAdmin/);
const exchange = JSON.parse(await execCtlOutput(
`--output json debug parse-exchange-string ${testStrings.default.replace(/\s/g, "")}`
));
assert.equal(typeof exchange, "object");
});
it("follows the log without a final result", async function() {
try {
assert.equal(await execCtlOutput("--output json log follow --controller"), "");
} finally {
getControl().keepOpen = false;
}
});
it("prints log queries in human mode", async function() {
assert.notEqual(await execCtlOutput("log query --controller --limit 1"), "");
});