diff --git a/src/runtime/browser/util.inspect.polyfil.ts b/src/runtime/browser/util.inspect.polyfil.ts index 26a3649..6bb0847 100644 --- a/src/runtime/browser/util.inspect.polyfil.ts +++ b/src/runtime/browser/util.inspect.polyfil.ts @@ -63,7 +63,7 @@ function isBoolean(arg: unknown) { } function isUndefined(arg: unknown) { - return arg == null; + return arg === undefined; } function stylizeNoColor(str: string) { diff --git a/tests/Browser/1_json.test.ts b/tests/Browser/1_json.test.ts index ffb77e2..e232f73 100644 --- a/tests/Browser/1_json.test.ts +++ b/tests/Browser/1_json.test.ts @@ -75,4 +75,14 @@ describe("Browser: JSON: Log level", () => { expect(consoleOutput).toContain("Foo bar"); }); + + it("pretty nullish", async () => { + await page.evaluate(() => { + // @ts-ignore + const logger = new tslog.Logger({ type: "pretty", stylePrettyLogs: false }); + logger.info({ foo: null, bar: undefined }); + }); + expect(consoleOutput).toContain("null"); + expect(consoleOutput).toContain("undefined"); + }); });