Setup logging transport in tests

Without a transport Winston will print annoying "Attempt to write logs
with no transports" warnings all over the place.  Setup a transport in
tests that cause logging to suppress this.
This commit is contained in:
Hornwitser committed 2026-09-15 22:18:16 +02:00
1 parent 2c52c265cf
commit ea1cb67502
20 files changed
+42 -9

No files matched your search

+3 -8
View File
@@ -8,11 +8,13 @@ import util from "node:util";
import events from "node:events";
import * as lib from "@clusterio/lib";
import { LineSplitter, ConsoleTransport, logger } from "@clusterio/lib";
import { LineSplitter, logger } from "@clusterio/lib";
import { selectTargetCommand, initialize as initializeCtl } from "@clusterio/ctl";
import { _listFactorioVersions } from "@clusterio/host/dist/node/src/server.js";
import "../setup_logging.js";
// Make sure permissions from plugins are loaded
import "../../plugins/global_chat/dist/node/index.js";
import "../../plugins/player_auth/dist/node/index.js";
@@ -316,13 +318,6 @@ before(async function() {
console.log("SILENT_TEST is present in env, loggers after bootstrap will be muted.");
}
// Some integration tests may cause log events
logger.add(new ConsoleTransport({
level: "info",
format: new lib.TerminalFormat(),
filter: () => !silent,
}));
// If fast test is enabled then output that it is
if (process.env.FAST_TEST) {