Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions test/js/bun/test/snapshot-tests/snapshots/snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,11 +891,18 @@ test("error snapshots", () => {
throw undefined; // this one doesn't work in jest because it doesn't think the function threw
}).toThrowErrorMatchingInlineSnapshot(`undefined`);
expect(() => {
expect(() => {}).toThrowErrorMatchingInlineSnapshot(`undefined`);
try {
expect(() => {}).toThrowErrorMatchingInlineSnapshot(`undefined`);
} catch (e) {
// The matcher error is colored only when this process has colors enabled
// (CI runs tests with FORCE_COLOR=1, a piped `bun test` run does not).
(e as Error).message = Bun.stripANSI((e as Error).message);
throw e;
}
}).toThrowErrorMatchingInlineSnapshot(`
"\x1B[2mexpect(\x1B[0m\x1B[31mreceived\x1B[0m\x1B[2m).\x1B[0mtoThrowErrorMatchingInlineSnapshot\x1B[2m(\x1B[0m\x1B[2m)\x1B[0m
"expect(received).toThrowErrorMatchingInlineSnapshot()

\x1B[1mMatcher error\x1B[0m: Received function did not throw
Matcher error: Received function did not throw
"
`);
});
Expand Down