diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bcb7263..a43c198 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,3 +31,13 @@ jobs:
run: yarn coverage
- name: Report coverage
uses: codecov/codecov-action@v3
+ tests-bun:
+ runs-on: ubuntu-latest
+ env:
+ CI: true
+ steps:
+ - uses: actions/checkout@v4
+ - uses: oven-sh/setup-bun@v2
+
+ - run: bun install
+ - run: bun test Nodejs
diff --git a/src/Logger.ts b/src/Logger.ts
index ee2d918..154dfaf 100644
--- a/src/Logger.ts
+++ b/src/Logger.ts
@@ -22,7 +22,9 @@ export class Logger {
constructor(options?: ILogOptionsParam, transports?: ITransport[], private stackDepthLevel: number = 4) {
const isBrowser = ![typeof window, typeof document].includes("undefined");
const isSafari = isBrowser ? /^((?!chrome|android).)*safari/i.test(navigator?.userAgent) : false;
- this.stackDepthLevel = isSafari ? 4 : this.stackDepthLevel;
+ const isBun = "Bun" in globalThis;
+
+ this.stackDepthLevel = isSafari ? 4 : isBun ? 3 : this.stackDepthLevel;
this.attachedTransports = transports || [new PrettyPrinterTransport(ConsoleSink, {})];
this.options = {
diff --git a/src/runtime/index.ts b/src/runtime/index.ts
index d4681f5..16ec82c 100644
--- a/src/runtime/index.ts
+++ b/src/runtime/index.ts
@@ -72,7 +72,7 @@ function stackLineToStackFrame(line?: string): IStackFrame {
method: undefined,
};
if (line != null) {
- const match = line.match(pathRegex);
+ const match = line.replaceAll("\\", "/").match(pathRegex);
if (match) {
pathResult.fullFilePath = match[1].replace(/\?.*$/, "");
const pathParts = pathResult.fullFilePath.split("/");
diff --git a/tests/Nodejs/2_pretty_loglevel.test.ts b/tests/Nodejs/2_pretty_loglevel.test.ts
index 51fc308..8f8ac0e 100644
--- a/tests/Nodejs/2_pretty_loglevel.test.ts
+++ b/tests/Nodejs/2_pretty_loglevel.test.ts
@@ -6,7 +6,7 @@ const logger = new Logger();
describe("Pretty: Log level", () => {
beforeEach(() => {
- mockConsoleLog(true, true);
+ mockConsoleLog(true, false);
});
test("silly (console)", (): void => {
diff --git a/tests/Nodejs/5_pretty_Log_Types.test.ts b/tests/Nodejs/5_pretty_Log_Types.test.ts
index 3b3d20b..8749f6c 100644
--- a/tests/Nodejs/5_pretty_Log_Types.test.ts
+++ b/tests/Nodejs/5_pretty_Log_Types.test.ts
@@ -86,7 +86,7 @@ describe("Pretty: Log Types", () => {
expect(getConsoleOutput()).toContain("test");
expect(getConsoleOutput()).toContain("error stack:\n");
expect(getConsoleOutput()).toContain("5_pretty_Log_Types.test.ts");
- expect(getConsoleOutput()).toContain("Object.");
+ expect(getConsoleOutput()).toContain("");
});
test("string and Error", (): void => {
@@ -96,6 +96,6 @@ describe("Pretty: Log Types", () => {
expect(getConsoleOutput()).toContain("test");
expect(getConsoleOutput()).toContain("error stack:\n");
expect(getConsoleOutput()).toContain("5_pretty_Log_Types.test.ts");
- expect(getConsoleOutput()).toContain("Object.");
+ expect(getConsoleOutput()).toContain("");
});
});
diff --git a/tsconfig.json b/tsconfig.json
index d6975b4..0283e4b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,8 +2,8 @@
"$schema": "http://json.schemastore.org/tsconfig",
"compileOnSave": false,
"compilerOptions": {
- "lib": ["es2020", "dom"],
- "target": "es2020",
+ "lib": ["ES2021", "dom"],
+ "target": "ES2021",
"module": "CommonJS",
"moduleResolution": "Node",
"types": ["node", "jest", "puppeteer", "jest-environment-puppeteer", "expect-puppeteer"],