diff --git a/test/setup-test-node.js b/test/setup-test-node.js index 0441fa01d..393fed3d2 100644 --- a/test/setup-test-node.js +++ b/test/setup-test-node.js @@ -6,9 +6,7 @@ const ByteBuffer = require('../components/bytebuffer/dist/ByteBufferAB.js'); const { setEnvironment, Environment } = require('../ts/environment'); -before(() => { - setEnvironment(Environment.Test); -}); +setEnvironment(Environment.Test); // To replicate logic we have on the client side global.window = { diff --git a/ts/logging/main_process_logging.ts b/ts/logging/main_process_logging.ts index 4614a2c2d..e8eca378f 100644 --- a/ts/logging/main_process_logging.ts +++ b/ts/logging/main_process_logging.ts @@ -17,6 +17,8 @@ import { read as readLastLines } from 'read-last-lines'; import rimraf from 'rimraf'; import { createStream } from 'rotating-file-stream'; +import { Environment, getEnvironment } from '../environment'; + import { LogEntryType, LogLevel, @@ -37,7 +39,10 @@ declare global { let globalLogger: undefined | pinoms.Logger; -const isRunningFromConsole = Boolean(process.stdout.isTTY); +const isRunningFromConsole = + Boolean(process.stdout.isTTY) || + getEnvironment() === Environment.Test || + getEnvironment() === Environment.TestLib; export async function initialize(): Promise { if (globalLogger) {