Skip to content

Commit d510305

Browse files
committed
fix undefined check, add null test for browser
1 parent 6ab687e commit d510305

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/runtime/browser/util.inspect.polyfil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function isBoolean(arg: unknown) {
6363
}
6464

6565
function isUndefined(arg: unknown) {
66-
return arg == null;
66+
return arg === undefined;
6767
}
6868

6969
function stylizeNoColor(str: string) {

tests/Browser/1_json.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,14 @@ describe("Browser: JSON: Log level", () => {
7575

7676
expect(consoleOutput).toContain("Foo bar");
7777
});
78+
79+
it("pretty nullish", async () => {
80+
await page.evaluate(() => {
81+
// @ts-ignore
82+
const logger = new tslog.Logger({ type: "pretty", stylePrettyLogs: false });
83+
logger.info({ foo: null, bar: undefined });
84+
});
85+
expect(consoleOutput).toContain("null");
86+
expect(consoleOutput).toContain("undefined");
87+
});
7888
});

0 commit comments

Comments
 (0)