aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-vscode/example/example.test.ts
blob: 8e855745cafbd574f3988cfc7bba18f6f0b65866 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { describe, test, expect } from "bun:test";

describe("example", () => {
  test("it works", () => {
    expect(1).toBe(1);
    expect(1).not.toBe(2);
    expect(() => {
      throw new TypeError("Oops! I did it again.");
    }).toThrow();
    expect(() => {
      throw new Error("Parent error.", {
        cause: new TypeError("Child error."),
      });
    }).toThrow();
    expect(() => {
      throw new AggregateError([new TypeError("Child error 1."), new TypeError("Child error 2.")], "Parent error.");
    }).toThrow();
    expect(() => {
      throw "This is a string error";
    }).toThrow();
    expect(() => {
      throw {
        message: "This is an object error",
        code: -1021,
      };
    }).toThrow();
  });
});