bun-types 1.0.11 → 1.0.12

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/types.d.ts +39 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Type definitions for Bun, an incredibly fast JavaScript runtime",
5
5
  "types": "types.d.ts",
6
6
  "files": [
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for bun 1.0.11
1
+ // Type definitions for bun 1.0.12
2
2
  // Project: https://github.com/oven-sh/bun
3
3
  // Definitions by: Jarred Sumner <https://github.com/Jarred-Sumner>
4
4
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7419,6 +7419,10 @@ declare module "bun:test" {
7419
7419
  * added to existing import statements. This is due to how ESM works.
7420
7420
  */
7421
7421
  module(id: string, factory: () => any): void | Promise<void>;
7422
+ /**
7423
+ * Restore the previous value of mocks.
7424
+ */
7425
+ restore(): void;
7422
7426
  };
7423
7427
 
7424
7428
  /**
@@ -7878,6 +7882,30 @@ declare module "bun:test" {
7878
7882
  anything: () => Expect;
7879
7883
  stringContaining: (str: string) => Expect<string>;
7880
7884
  stringMatching: <T extends RegExp | string>(regex: T) => Expect<T>;
7885
+
7886
+ /**
7887
+ * Throw an error if this function is called.
7888
+ *
7889
+ * @param msg Optional message to display if the test fails
7890
+ * @returns never
7891
+ *
7892
+ * @example
7893
+ * ## Example
7894
+ *
7895
+ * ```ts
7896
+ * import { expect, test } from "bun:test";
7897
+ *
7898
+ * test("!!abc!! is not a module", () => {
7899
+ * try {
7900
+ * require("!!abc!!");
7901
+ * expect.unreachable();
7902
+ * } catch(e) {
7903
+ * expect(e.name).not.toBe("UnreachableError");
7904
+ * }
7905
+ * });
7906
+ * ```
7907
+ */
7908
+ unreachable(msg?: string | Error): never;
7881
7909
  };
7882
7910
  /**
7883
7911
  * Asserts that a value matches some criteria.
@@ -8127,14 +8155,14 @@ declare module "bun:test" {
8127
8155
  */
8128
8156
  toBeNull(): void;
8129
8157
  /**
8130
- * Asserts that a value can be coerced to `NaN`.
8158
+ * Asserts that a value is `NaN`.
8131
8159
  *
8132
8160
  * Same as using `Number.isNaN()`.
8133
8161
  *
8134
8162
  * @example
8135
8163
  * expect(NaN).toBeNaN();
8136
- * expect(Infinity).toBeNaN();
8137
- * expect("notanumber").toBeNaN();
8164
+ * expect(Infinity).toBeNaN(); // fail
8165
+ * expect("notanumber").toBeNaN(); // fail
8138
8166
  */
8139
8167
  toBeNaN(): void;
8140
8168
  /**
@@ -25890,8 +25918,11 @@ declare module "util" {
25890
25918
  * // when printed to a terminal.
25891
25919
  * ```
25892
25920
  */
25893
- // FIXME: util.formatWithOptions is typed, but is not defined in the polyfill
25894
- // export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string;
25921
+ export function formatWithOptions(
25922
+ inspectOptions: InspectOptions,
25923
+ format?: any,
25924
+ ...param: any[]
25925
+ ): string;
25895
25926
  /**
25896
25927
  * Returns the string name for a numeric error code that comes from a Node.js API.
25897
25928
  * The mapping between error codes and error names is platform-dependent.
@@ -38628,6 +38659,8 @@ declare module "bun" {
38628
38659
  */
38629
38660
  readonly pendingWebSockets: number;
38630
38661
 
38662
+ readonly url: URL;
38663
+
38631
38664
  readonly port: number;
38632
38665
  /**
38633
38666
  * The hostname the server is listening on. Does not include the port