mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
* Cleanup error formatting a little * Add error for using import statement with CommonJS-only features * Update js_ast.zig * Further tweaks to formatting, also print error.cause * Add some snapshot tests for errors * Make these snapshot tests * Ignore mimalloc warnings * Update error message parsing in bundling tests * Increase timeout on the test * Update expectBundled.ts * Update test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
22 lines
625 B
JavaScript
22 lines
625 B
JavaScript
import { test, expect } from "bun:test";
|
|
|
|
test("error.cause", () => {
|
|
const err = new Error("error 1");
|
|
const err2 = new Error("error 2", { cause: err });
|
|
expect(Bun.inspect(err2).replaceAll(import.meta.dir, "[dir]")).toMatchSnapshot();
|
|
});
|
|
|
|
test("Error", () => {
|
|
const err = new Error("my message");
|
|
expect(Bun.inspect(err).replaceAll(import.meta.dir, "[dir]")).toMatchSnapshot();
|
|
});
|
|
|
|
test("BuildMessage", async () => {
|
|
try {
|
|
await import("./inspect-error-fixture-bad.js");
|
|
expect.unreachable();
|
|
} catch (e) {
|
|
expect(Bun.inspect(e).replaceAll(import.meta.dir, "[dir]")).toMatchSnapshot();
|
|
}
|
|
});
|