bun-types 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test.d.ts +46 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.35",
2
+ "version": "1.0.36",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",
package/test.d.ts CHANGED
@@ -1188,6 +1188,27 @@ declare module "bun:test" {
1188
1188
  * @param expected the expected error, error message, or error pattern
1189
1189
  */
1190
1190
  toThrow(expected?: unknown): void;
1191
+ /**
1192
+ * Asserts that a function throws an error.
1193
+ *
1194
+ * - If expected is a `string` or `RegExp`, it will check the `message` property.
1195
+ * - If expected is an `Error` object, it will check the `name` and `message` properties.
1196
+ * - If expected is an `Error` constructor, it will check the class of the `Error`.
1197
+ * - If expected is not provided, it will check if anything as thrown.
1198
+ *
1199
+ * @example
1200
+ * function fail() {
1201
+ * throw new Error("Oops!");
1202
+ * }
1203
+ * expect(fail).toThrowError("Oops!");
1204
+ * expect(fail).toThrowError(/oops/i);
1205
+ * expect(fail).toThrowError(Error);
1206
+ * expect(fail).toThrowError();
1207
+ *
1208
+ * @param expected the expected error, error message, or error pattern
1209
+ * @alias toThrow
1210
+ */
1211
+ toThrowError(expected?: unknown): void;
1191
1212
  /**
1192
1213
  * Asserts that a value matches a regular expression or includes a substring.
1193
1214
  *
@@ -1481,22 +1502,47 @@ declare module "bun:test" {
1481
1502
  * Ensures that a mock function is called.
1482
1503
  */
1483
1504
  toHaveBeenCalled(): void;
1505
+ /**
1506
+ * Ensures that a mock function is called an exact number of times.
1507
+ * @alias toHaveBeenCalled
1508
+ */
1509
+ toBeCalled(): void;
1484
1510
  /**
1485
1511
  * Ensures that a mock function is called an exact number of times.
1486
1512
  */
1487
1513
  toHaveBeenCalledTimes(expected: number): void;
1514
+ /**
1515
+ * Ensure that a mock function is called with specific arguments.
1516
+ * @alias toHaveBeenCalledTimes
1517
+ */
1518
+ toBeCalledTimes(expected: number): void;
1488
1519
  /**
1489
1520
  * Ensure that a mock function is called with specific arguments.
1490
1521
  */
1491
1522
  toHaveBeenCalledWith(...expected: unknown[]): void;
1523
+ /**
1524
+ * Ensure that a mock function is called with specific arguments.
1525
+ * @alias toHaveBeenCalledWith
1526
+ */
1527
+ toBeCalledWith(...expected: unknown[]): void;
1492
1528
  /**
1493
1529
  * Ensure that a mock function is called with specific arguments for the last call.
1494
1530
  */
1495
1531
  toHaveBeenLastCalledWith(...expected: unknown[]): void;
1532
+ /**
1533
+ * Ensure that a mock function is called with specific arguments for the nth call.
1534
+ * @alias toHaveBeenCalledWith
1535
+ */
1536
+ lastCalledWith(...expected: unknown[]): void;
1496
1537
  /**
1497
1538
  * Ensure that a mock function is called with specific arguments for the nth call.
1498
1539
  */
1499
1540
  toHaveBeenNthCalledWith(n: number, ...expected: unknown[]): void;
1541
+ /**
1542
+ * Ensure that a mock function is called with specific arguments for the nth call.
1543
+ * @alias toHaveBeenCalledWith
1544
+ */
1545
+ nthCalledWith(n: number, ...expected: unknown[]): void;
1500
1546
  }
1501
1547
 
1502
1548
  /**