Skip to content

Commit

Permalink
fix undefined check, add null test for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
vktrl committed Aug 22, 2023
1 parent 6ab687e commit d510305
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/browser/util.inspect.polyfil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function isBoolean(arg: unknown) {
}

function isUndefined(arg: unknown) {
return arg == null;
return arg === undefined;
}

function stylizeNoColor(str: string) {
Expand Down
10 changes: 10 additions & 0 deletions tests/Browser/1_json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});

0 comments on commit d510305

Please sign in to comment.