diff --git a/src/consola.ts b/src/consola.ts index baefd8fb..a698320c 100644 --- a/src/consola.ts +++ b/src/consola.ts @@ -311,7 +311,7 @@ export class Consola { // Process queue const _queue = queue.splice(0); for (const item of _queue) { - item[0]._logFn(item[1], item[2]); + item[0]._logFn(item[1], item[2], item[3]); } } diff --git a/test/consola.test.ts b/test/consola.test.ts index ae9e177f..00fec4f9 100644 --- a/test/consola.test.ts +++ b/test/consola.test.ts @@ -56,6 +56,27 @@ describe("consola", () => { expect(logs.at(-1)!.args).toEqual(["SPAM", "(repeated 4 times)"]); }); + + test("preserves raw logs queued while paused", () => { + const logs: LogObject[] = []; + const TestReporter: ConsolaReporter = { + log(logObj) { + logs.push(logObj); + }, + }; + + const consola = createConsola({ + level: LogLevels.info, + reporters: [TestReporter], + }); + + consola.pauseLogs(); + consola.warn.raw({ message: "raw warning" }); + consola.resumeLogs(); + + expect(logs).toHaveLength(1); + expect(logs[0].args).toEqual([{ message: "raw warning" }]); + }); }); function wait(delay) {