bun-types 1.2.22-canary.20250909T140611 → 1.2.22-canary.20250910T140559
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.
- package/bun.d.ts +1 -0
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/bundler/index.md +9 -0
- package/docs/cli/pm.md +1 -1
- package/docs/cli/publish.md +1 -1
- package/docs/guides/ecosystem/nextjs.md +2 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/install/add-peer.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/version.md +1 -1
- package/docs/installation.md +4 -4
- package/docs/runtime/debugger.md +3 -3
- package/docs/test/dom.md +1 -1
- package/docs/test/writing.md +73 -0
- package/package.json +1 -1
- package/shell.d.ts +2 -2
- package/test.d.ts +109 -17
package/bun.d.ts
CHANGED
package/docs/api/fetch.md
CHANGED
|
@@ -336,7 +336,7 @@ This will print the request and response headers to your terminal:
|
|
|
336
336
|
```sh
|
|
337
337
|
[fetch] > HTTP/1.1 GET http://example.com/
|
|
338
338
|
[fetch] > Connection: keep-alive
|
|
339
|
-
[fetch] > User-Agent: Bun/1.2.22-canary.
|
|
339
|
+
[fetch] > User-Agent: Bun/1.2.22-canary.20250910T140559
|
|
340
340
|
[fetch] > Accept: */*
|
|
341
341
|
[fetch] > Host: example.com
|
|
342
342
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/api/spawn.md
CHANGED
|
@@ -140,7 +140,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
|
|
|
140
140
|
```ts
|
|
141
141
|
const proc = Bun.spawn(["bun", "--version"]);
|
|
142
142
|
const text = await proc.stdout.text();
|
|
143
|
-
console.log(text); // => "1.2.22-canary.
|
|
143
|
+
console.log(text); // => "1.2.22-canary.20250910T140559\n"
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
Configure the output stream by passing one of the following values to `stdout/stderr`:
|
package/docs/bundler/index.md
CHANGED
|
@@ -733,6 +733,10 @@ Whether to enable minification. Default `false`.
|
|
|
733
733
|
When targeting `bun`, identifiers will be minified by default.
|
|
734
734
|
{% /callout %}
|
|
735
735
|
|
|
736
|
+
{% callout %}
|
|
737
|
+
When `minify.syntax` is enabled, unused function and class expression names are removed unless `minify.keepNames` is set to `true` or `--keep-names` flag is used.
|
|
738
|
+
{% /callout %}
|
|
739
|
+
|
|
736
740
|
To enable all minification options:
|
|
737
741
|
|
|
738
742
|
{% codetabs group="a" %}
|
|
@@ -763,12 +767,16 @@ await Bun.build({
|
|
|
763
767
|
whitespace: true,
|
|
764
768
|
identifiers: true,
|
|
765
769
|
syntax: true,
|
|
770
|
+
keepNames: false, // default
|
|
766
771
|
},
|
|
767
772
|
})
|
|
768
773
|
```
|
|
769
774
|
|
|
770
775
|
```bash#CLI
|
|
771
776
|
$ bun build ./index.tsx --outdir ./out --minify-whitespace --minify-identifiers --minify-syntax
|
|
777
|
+
|
|
778
|
+
# To preserve function and class names during minification:
|
|
779
|
+
$ bun build ./index.tsx --outdir ./out --minify --keep-names
|
|
772
780
|
```
|
|
773
781
|
|
|
774
782
|
{% /codetabs %}
|
|
@@ -1553,6 +1561,7 @@ interface BuildConfig {
|
|
|
1553
1561
|
whitespace?: boolean;
|
|
1554
1562
|
syntax?: boolean;
|
|
1555
1563
|
identifiers?: boolean;
|
|
1564
|
+
keepNames?: boolean;
|
|
1556
1565
|
};
|
|
1557
1566
|
/**
|
|
1558
1567
|
* Ignore dead code elimination/tree-shaking annotations such as @__PURE__ and package.json
|
package/docs/cli/pm.md
CHANGED
|
@@ -213,7 +213,7 @@ To display current package version and help:
|
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
215
|
$ bun pm version
|
|
216
|
-
bun pm version v1.2.22-canary.
|
|
216
|
+
bun pm version v1.2.22-canary.20250910T140559 (ca7428e9)
|
|
217
217
|
Current package version: v1.0.0
|
|
218
218
|
|
|
219
219
|
Increment:
|
package/docs/cli/publish.md
CHANGED
|
@@ -9,8 +9,9 @@ $ bun create next-app
|
|
|
9
9
|
✔ What is your project named? … my-app
|
|
10
10
|
✔ Would you like to use TypeScript with this project? … No / Yes
|
|
11
11
|
✔ Would you like to use ESLint with this project? … No / Yes
|
|
12
|
+
✔ Would you like to use Tailwind CSS? ... No / Yes
|
|
12
13
|
✔ Would you like to use `src/` directory with this project? … No / Yes
|
|
13
|
-
✔ Would you like to use
|
|
14
|
+
✔ Would you like to use App Router? (recommended) ... No / Yes
|
|
14
15
|
✔ What import alias would you like configured? … @/*
|
|
15
16
|
Creating a new Next.js app in /path/to/my-app.
|
|
16
17
|
```
|
|
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
|
|
|
9
9
|
✔ Which package manager would you like to use?
|
|
10
10
|
bun
|
|
11
11
|
◐ Installing dependencies...
|
|
12
|
-
bun install v1.2.22-canary.
|
|
12
|
+
bun install v1.2.22-canary.20250910T140559 (16b4bf34)
|
|
13
13
|
+ @nuxt/devtools@0.8.2
|
|
14
14
|
+ nuxt@3.7.0
|
|
15
15
|
785 packages installed [2.67s]
|
|
@@ -15,7 +15,7 @@ This will add the package to `peerDependencies` in `package.json`.
|
|
|
15
15
|
```json-diff
|
|
16
16
|
{
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
+ "@types/bun": "^1.2.22-canary.
|
|
18
|
+
+ "@types/bun": "^1.2.22-canary.20250910T140559"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
```
|
|
@@ -27,7 +27,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
|
|
|
27
27
|
```json-diff
|
|
28
28
|
{
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@types/bun": "^1.2.22-canary.
|
|
30
|
+
"@types/bun": "^1.2.22-canary.20250910T140559"
|
|
31
31
|
},
|
|
32
32
|
"peerDependenciesMeta": {
|
|
33
33
|
+ "@types/bun": {
|
|
@@ -97,7 +97,7 @@ $ bun update
|
|
|
97
97
|
$ bun update @types/bun --latest
|
|
98
98
|
|
|
99
99
|
# Update a dependency to a specific version
|
|
100
|
-
$ bun update @types/bun@1.2.22-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.22-canary.20250910T140559
|
|
101
101
|
|
|
102
102
|
# Update all dependencies to the latest versions
|
|
103
103
|
$ bun update --latest
|
|
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
|
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
$ bun test
|
|
24
|
-
bun test v1.2.22-canary.
|
|
24
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
25
25
|
|
|
26
26
|
test.test.js:
|
|
27
27
|
✓ add [0.87ms]
|
|
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
|
|
|
47
47
|
|
|
48
48
|
```sh
|
|
49
49
|
$ bun test test3
|
|
50
|
-
bun test v1.2.22-canary.
|
|
50
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
51
51
|
|
|
52
52
|
test3.test.js:
|
|
53
53
|
✓ add [1.40ms]
|
|
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
|
|
|
85
85
|
|
|
86
86
|
```sh
|
|
87
87
|
$ bun test -t add
|
|
88
|
-
bun test v1.2.22-canary.
|
|
88
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
89
89
|
|
|
90
90
|
test.test.js:
|
|
91
91
|
✓ add [1.79ms]
|
|
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
$ bun test test/snap
|
|
21
|
-
bun test v1.2.22-canary.
|
|
21
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
22
22
|
|
|
23
23
|
test/snap.test.ts:
|
|
24
24
|
✓ snapshot [1.48ms]
|
|
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
|
|
|
61
61
|
|
|
62
62
|
```sh
|
|
63
63
|
$ bun test
|
|
64
|
-
bun test v1.2.22-canary.
|
|
64
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
65
65
|
|
|
66
66
|
test/snap.test.ts:
|
|
67
67
|
✓ snapshot [1.05ms]
|
|
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
|
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
80
|
$ bun test --update-snapshots
|
|
81
|
-
bun test v1.2.22-canary.
|
|
81
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
82
82
|
|
|
83
83
|
test/snap.test.ts:
|
|
84
84
|
✓ snapshot [0.86ms]
|
|
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ bun test --update-snapshots
|
|
32
|
-
bun test v1.2.22-canary.
|
|
32
|
+
bun test v1.2.22-canary.20250910T140559 (9c68abdb)
|
|
33
33
|
|
|
34
34
|
test/snap.test.ts:
|
|
35
35
|
✓ snapshot [0.86ms]
|
package/docs/installation.md
CHANGED
|
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
|
|
|
14
14
|
```bash#macOS/Linux_(curl)
|
|
15
15
|
$ curl -fsSL https://bun.com/install | bash # for macOS, Linux, and WSL
|
|
16
16
|
# to install a specific version
|
|
17
|
-
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.22-canary.
|
|
17
|
+
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.22-canary.20250910T140559"
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
```bash#npm
|
|
@@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
|
|
|
189
189
|
|
|
190
190
|
### Installing a specific version of Bun on Linux/Mac
|
|
191
191
|
|
|
192
|
-
To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.22-canary.
|
|
192
|
+
To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.22-canary.20250910T140559`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.22-canary.
|
|
195
|
+
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.22-canary.20250910T140559"
|
|
196
196
|
```
|
|
197
197
|
|
|
198
198
|
### Installing a specific version of Bun on Windows
|
|
@@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num
|
|
|
201
201
|
|
|
202
202
|
```sh
|
|
203
203
|
# PowerShell:
|
|
204
|
-
$ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.22-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.22-canary.20250910T140559"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
package/docs/runtime/debugger.md
CHANGED
|
@@ -124,11 +124,11 @@ await fetch("https://example.com", {
|
|
|
124
124
|
This prints the `fetch` request as a single-line `curl` command to let you copy-paste into your terminal to replicate the request.
|
|
125
125
|
|
|
126
126
|
```sh
|
|
127
|
-
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.22-canary.
|
|
127
|
+
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.22-canary.20250910T140559" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
|
|
128
128
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
129
129
|
[fetch] > content-type: application/json
|
|
130
130
|
[fetch] > Connection: keep-alive
|
|
131
|
-
[fetch] > User-Agent: Bun/1.2.22-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.22-canary.20250910T140559
|
|
132
132
|
[fetch] > Accept: */*
|
|
133
133
|
[fetch] > Host: example.com
|
|
134
134
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -170,7 +170,7 @@ This prints the following to the console:
|
|
|
170
170
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
171
171
|
[fetch] > content-type: application/json
|
|
172
172
|
[fetch] > Connection: keep-alive
|
|
173
|
-
[fetch] > User-Agent: Bun/1.2.22-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.22-canary.20250910T140559
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/test/dom.md
CHANGED
package/docs/test/writing.md
CHANGED
|
@@ -756,3 +756,76 @@ Bun implements the following matchers. Full Jest compatibility is on the roadmap
|
|
|
756
756
|
- [`.toThrowErrorMatchingInlineSnapshot()`](https://jestjs.io/docs/expect#tothrowerrormatchinginlinesnapshotinlinesnapshot)
|
|
757
757
|
|
|
758
758
|
{% /table %}
|
|
759
|
+
|
|
760
|
+
## TypeScript Type Safety
|
|
761
|
+
|
|
762
|
+
Bun's test runner provides enhanced TypeScript support with intelligent type checking for your test assertions. The type system helps catch potential bugs at compile time while still allowing flexibility when needed.
|
|
763
|
+
|
|
764
|
+
### Strict Type Checking by Default
|
|
765
|
+
|
|
766
|
+
By default, Bun's test matchers enforce strict type checking between the actual value and expected value:
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
import { expect, test } from "bun:test";
|
|
770
|
+
|
|
771
|
+
test("strict typing", () => {
|
|
772
|
+
const str = "hello";
|
|
773
|
+
const num = 42;
|
|
774
|
+
|
|
775
|
+
expect(str).toBe("hello"); // ✅ OK: string to string
|
|
776
|
+
expect(num).toBe(42); // ✅ OK: number to number
|
|
777
|
+
expect(str).toBe(42); // ❌ TypeScript error: string vs number
|
|
778
|
+
});
|
|
779
|
+
```
|
|
780
|
+
|
|
781
|
+
This helps catch common mistakes where you might accidentally compare values of different types.
|
|
782
|
+
|
|
783
|
+
### Relaxed Type Checking with Type Parameters
|
|
784
|
+
|
|
785
|
+
Sometimes you need more flexibility in your tests, especially when working with:
|
|
786
|
+
|
|
787
|
+
- Dynamic data from APIs
|
|
788
|
+
- Polymorphic functions that can return multiple types
|
|
789
|
+
- Generic utility functions
|
|
790
|
+
- Migration of existing test suites
|
|
791
|
+
|
|
792
|
+
For these cases, you can "opt out" of strict type checking by providing an explicit type parameter to matcher methods:
|
|
793
|
+
|
|
794
|
+
```ts
|
|
795
|
+
import { expect, test } from "bun:test";
|
|
796
|
+
|
|
797
|
+
test("relaxed typing with type parameters", () => {
|
|
798
|
+
const value: unknown = getSomeValue();
|
|
799
|
+
|
|
800
|
+
// These would normally cause TypeScript errors, but type parameters allow them:
|
|
801
|
+
expect(value).toBe<number>(42); // No TS error, runtime check still works
|
|
802
|
+
expect(value).toEqual<string>("hello"); // No TS error, runtime check still works
|
|
803
|
+
expect(value).toStrictEqual<boolean>(true); // No TS error, runtime check still works
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
test("useful for dynamic data", () => {
|
|
807
|
+
const apiResponse: any = { status: "success" };
|
|
808
|
+
|
|
809
|
+
// Without type parameter: TypeScript error (any vs string)
|
|
810
|
+
// expect(apiResponse.status).toBe("success");
|
|
811
|
+
|
|
812
|
+
// With type parameter: No TypeScript error, runtime assertion still enforced
|
|
813
|
+
expect(apiResponse.status).toBe<string>("success"); // ✅ OK
|
|
814
|
+
});
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
### Migration from Looser Type Systems
|
|
818
|
+
|
|
819
|
+
If migrating from a test framework with looser TypeScript integration, you can use type parameters as a stepping stone:
|
|
820
|
+
|
|
821
|
+
```ts
|
|
822
|
+
// Old Jest test that worked but wasn't type-safe
|
|
823
|
+
expect(response.data).toBe(200); // No type error in some setups
|
|
824
|
+
|
|
825
|
+
// Bun equivalent with explicit typing during migration
|
|
826
|
+
expect(response.data).toBe<number>(200); // Explicit about expected type
|
|
827
|
+
|
|
828
|
+
// Ideal Bun test after refactoring
|
|
829
|
+
const statusCode: number = response.data;
|
|
830
|
+
expect(statusCode).toBe(200); // Type-safe without explicit parameter
|
|
831
|
+
```
|
package/package.json
CHANGED
package/shell.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare module "bun" {
|
|
|
58
58
|
* // "bun"
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
function env(newEnv?: Record<string, string | undefined>): $;
|
|
61
|
+
function env(newEnv?: Record<string, string | undefined> | NodeJS.Dict<string> | undefined): $;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
*
|
|
@@ -106,7 +106,7 @@ declare module "bun" {
|
|
|
106
106
|
* expect(stdout.toString()).toBe("LOL!");
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
109
|
-
env(newEnv: Record<string, string> | undefined): this;
|
|
109
|
+
env(newEnv: Record<string, string | undefined> | NodeJS.Dict<string> | undefined): this;
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* By default, the shell will write to the current process's stdout and stderr, as well as buffering that output.
|
package/test.d.ts
CHANGED
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
declare module "bun:test" {
|
|
17
|
-
/**
|
|
18
|
-
* -- Mocks --
|
|
19
|
-
*
|
|
20
|
-
* @category Testing
|
|
21
|
-
*/
|
|
22
17
|
export type Mock<T extends (...args: any[]) => any> = JestMock.Mock<T>;
|
|
23
18
|
|
|
24
19
|
export const mock: {
|
|
@@ -588,7 +583,9 @@ declare module "bun:test" {
|
|
|
588
583
|
* @param customFailMessage an optional custom message to display if the test fails.
|
|
589
584
|
* */
|
|
590
585
|
|
|
591
|
-
|
|
586
|
+
(actual?: never, customFailMessage?: string): Matchers<undefined>;
|
|
587
|
+
<T = unknown>(actual: T, customFailMessage?: string): Matchers<T>;
|
|
588
|
+
<T = unknown>(actual?: T, customFailMessage?: string): Matchers<T | undefined>;
|
|
592
589
|
|
|
593
590
|
/**
|
|
594
591
|
* Access to negated asymmetric matchers.
|
|
@@ -906,6 +903,7 @@ declare module "bun:test" {
|
|
|
906
903
|
* @param message the message to display if the test fails (optional)
|
|
907
904
|
*/
|
|
908
905
|
pass: (message?: string) => void;
|
|
906
|
+
|
|
909
907
|
/**
|
|
910
908
|
* Assertion which fails.
|
|
911
909
|
*
|
|
@@ -917,6 +915,7 @@ declare module "bun:test" {
|
|
|
917
915
|
* expect().not.fail("hi");
|
|
918
916
|
*/
|
|
919
917
|
fail: (message?: string) => void;
|
|
918
|
+
|
|
920
919
|
/**
|
|
921
920
|
* Asserts that a value equals what is expected.
|
|
922
921
|
*
|
|
@@ -930,9 +929,15 @@ declare module "bun:test" {
|
|
|
930
929
|
* expect([123]).toBe([123]); // fail, use toEqual()
|
|
931
930
|
* expect(3 + 0.14).toBe(3.14); // fail, use toBeCloseTo()
|
|
932
931
|
*
|
|
932
|
+
* // TypeScript errors:
|
|
933
|
+
* expect("hello").toBe(3.14); // typescript error + fail
|
|
934
|
+
* expect("hello").toBe<number>(3.14); // no typescript error, but still fails
|
|
935
|
+
*
|
|
933
936
|
* @param expected the expected value
|
|
934
937
|
*/
|
|
935
938
|
toBe(expected: T): void;
|
|
939
|
+
toBe<X = T>(expected: NoInfer<X>): void;
|
|
940
|
+
|
|
936
941
|
/**
|
|
937
942
|
* Asserts that a number is odd.
|
|
938
943
|
*
|
|
@@ -942,6 +947,7 @@ declare module "bun:test" {
|
|
|
942
947
|
* expect(2).not.toBeOdd();
|
|
943
948
|
*/
|
|
944
949
|
toBeOdd(): void;
|
|
950
|
+
|
|
945
951
|
/**
|
|
946
952
|
* Asserts that a number is even.
|
|
947
953
|
*
|
|
@@ -951,6 +957,7 @@ declare module "bun:test" {
|
|
|
951
957
|
* expect(1).not.toBeEven();
|
|
952
958
|
*/
|
|
953
959
|
toBeEven(): void;
|
|
960
|
+
|
|
954
961
|
/**
|
|
955
962
|
* Asserts that value is close to the expected by floating point precision.
|
|
956
963
|
*
|
|
@@ -969,6 +976,7 @@ declare module "bun:test" {
|
|
|
969
976
|
* @param numDigits the number of digits to check after the decimal point. Default is `2`
|
|
970
977
|
*/
|
|
971
978
|
toBeCloseTo(expected: number, numDigits?: number): void;
|
|
979
|
+
|
|
972
980
|
/**
|
|
973
981
|
* Asserts that a value is deeply equal to what is expected.
|
|
974
982
|
*
|
|
@@ -981,6 +989,8 @@ declare module "bun:test" {
|
|
|
981
989
|
* @param expected the expected value
|
|
982
990
|
*/
|
|
983
991
|
toEqual(expected: T): void;
|
|
992
|
+
toEqual<X = T>(expected: NoInfer<X>): void;
|
|
993
|
+
|
|
984
994
|
/**
|
|
985
995
|
* Asserts that a value is deeply and strictly equal to
|
|
986
996
|
* what is expected.
|
|
@@ -1005,6 +1015,8 @@ declare module "bun:test" {
|
|
|
1005
1015
|
* @param expected the expected value
|
|
1006
1016
|
*/
|
|
1007
1017
|
toStrictEqual(expected: T): void;
|
|
1018
|
+
toStrictEqual<X = T>(expected: NoInfer<X>): void;
|
|
1019
|
+
|
|
1008
1020
|
/**
|
|
1009
1021
|
* Asserts that the value is deep equal to an element in the expected array.
|
|
1010
1022
|
*
|
|
@@ -1017,7 +1029,9 @@ declare module "bun:test" {
|
|
|
1017
1029
|
*
|
|
1018
1030
|
* @param expected the expected value
|
|
1019
1031
|
*/
|
|
1020
|
-
toBeOneOf(expected:
|
|
1032
|
+
toBeOneOf(expected: Iterable<T>): void;
|
|
1033
|
+
toBeOneOf<X = T>(expected: NoInfer<Iterable<X>>): void;
|
|
1034
|
+
|
|
1021
1035
|
/**
|
|
1022
1036
|
* Asserts that a value contains what is expected.
|
|
1023
1037
|
*
|
|
@@ -1031,7 +1045,9 @@ declare module "bun:test" {
|
|
|
1031
1045
|
*
|
|
1032
1046
|
* @param expected the expected value
|
|
1033
1047
|
*/
|
|
1034
|
-
toContain(expected:
|
|
1048
|
+
toContain(expected: T extends Iterable<infer U> ? U : T): void;
|
|
1049
|
+
toContain<X = T>(expected: NoInfer<X extends Iterable<infer U> ? U : X>): void;
|
|
1050
|
+
|
|
1035
1051
|
/**
|
|
1036
1052
|
* Asserts that an `object` contains a key.
|
|
1037
1053
|
*
|
|
@@ -1045,7 +1061,9 @@ declare module "bun:test" {
|
|
|
1045
1061
|
*
|
|
1046
1062
|
* @param expected the expected value
|
|
1047
1063
|
*/
|
|
1048
|
-
toContainKey(expected:
|
|
1064
|
+
toContainKey(expected: keyof T): void;
|
|
1065
|
+
toContainKey<X = T>(expected: NoInfer<keyof X>): void;
|
|
1066
|
+
|
|
1049
1067
|
/**
|
|
1050
1068
|
* Asserts that an `object` contains all the provided keys.
|
|
1051
1069
|
*
|
|
@@ -1060,7 +1078,9 @@ declare module "bun:test" {
|
|
|
1060
1078
|
*
|
|
1061
1079
|
* @param expected the expected value
|
|
1062
1080
|
*/
|
|
1063
|
-
toContainAllKeys(expected:
|
|
1081
|
+
toContainAllKeys(expected: Array<keyof T>): void;
|
|
1082
|
+
toContainAllKeys<X = T>(expected: NoInfer<Array<keyof X>>): void;
|
|
1083
|
+
|
|
1064
1084
|
/**
|
|
1065
1085
|
* Asserts that an `object` contains at least one of the provided keys.
|
|
1066
1086
|
* Asserts that an `object` contains all the provided keys.
|
|
@@ -1075,12 +1095,16 @@ declare module "bun:test" {
|
|
|
1075
1095
|
*
|
|
1076
1096
|
* @param expected the expected value
|
|
1077
1097
|
*/
|
|
1078
|
-
toContainAnyKeys(expected:
|
|
1098
|
+
toContainAnyKeys(expected: Array<keyof T>): void;
|
|
1099
|
+
toContainAnyKeys<X = T>(expected: NoInfer<Array<keyof X>>): void;
|
|
1079
1100
|
|
|
1080
1101
|
/**
|
|
1081
1102
|
* Asserts that an `object` contain the provided value.
|
|
1082
1103
|
*
|
|
1083
|
-
*
|
|
1104
|
+
* This method is deep and will look through child properties to find the
|
|
1105
|
+
* expected value.
|
|
1106
|
+
*
|
|
1107
|
+
* The input value must be an object.
|
|
1084
1108
|
*
|
|
1085
1109
|
* @example
|
|
1086
1110
|
* const shallow = { hello: "world" };
|
|
@@ -1104,11 +1128,16 @@ declare module "bun:test" {
|
|
|
1104
1128
|
*
|
|
1105
1129
|
* @param expected the expected value
|
|
1106
1130
|
*/
|
|
1131
|
+
// Contributor note: In theory we could type this better but it would be a
|
|
1132
|
+
// slow union to compute...
|
|
1107
1133
|
toContainValue(expected: unknown): void;
|
|
1108
1134
|
|
|
1109
1135
|
/**
|
|
1110
1136
|
* Asserts that an `object` contain the provided value.
|
|
1111
1137
|
*
|
|
1138
|
+
* This is the same as {@link toContainValue}, but accepts an array of
|
|
1139
|
+
* values instead.
|
|
1140
|
+
*
|
|
1112
1141
|
* The value must be an object
|
|
1113
1142
|
*
|
|
1114
1143
|
* @example
|
|
@@ -1118,7 +1147,7 @@ declare module "bun:test" {
|
|
|
1118
1147
|
* expect(o).not.toContainValues(['qux', 'foo']);
|
|
1119
1148
|
* @param expected the expected value
|
|
1120
1149
|
*/
|
|
1121
|
-
toContainValues(expected: unknown): void;
|
|
1150
|
+
toContainValues(expected: Array<unknown>): void;
|
|
1122
1151
|
|
|
1123
1152
|
/**
|
|
1124
1153
|
* Asserts that an `object` contain all the provided values.
|
|
@@ -1132,7 +1161,7 @@ declare module "bun:test" {
|
|
|
1132
1161
|
* expect(o).not.toContainAllValues(['bar', 'foo']);
|
|
1133
1162
|
* @param expected the expected value
|
|
1134
1163
|
*/
|
|
1135
|
-
toContainAllValues(expected: unknown): void;
|
|
1164
|
+
toContainAllValues(expected: Array<unknown>): void;
|
|
1136
1165
|
|
|
1137
1166
|
/**
|
|
1138
1167
|
* Asserts that an `object` contain any provided value.
|
|
@@ -1147,7 +1176,7 @@ declare module "bun:test" {
|
|
|
1147
1176
|
* expect(o).not.toContainAnyValues(['qux']);
|
|
1148
1177
|
* @param expected the expected value
|
|
1149
1178
|
*/
|
|
1150
|
-
toContainAnyValues(expected: unknown): void;
|
|
1179
|
+
toContainAnyValues(expected: Array<unknown>): void;
|
|
1151
1180
|
|
|
1152
1181
|
/**
|
|
1153
1182
|
* Asserts that an `object` contains all the provided keys.
|
|
@@ -1159,7 +1188,9 @@ declare module "bun:test" {
|
|
|
1159
1188
|
*
|
|
1160
1189
|
* @param expected the expected value
|
|
1161
1190
|
*/
|
|
1162
|
-
toContainKeys(expected:
|
|
1191
|
+
toContainKeys(expected: Array<keyof T>): void;
|
|
1192
|
+
toContainKeys<X = T>(expected: NoInfer<Array<keyof X>>): void;
|
|
1193
|
+
|
|
1163
1194
|
/**
|
|
1164
1195
|
* Asserts that a value contains and equals what is expected.
|
|
1165
1196
|
*
|
|
@@ -1172,7 +1203,9 @@ declare module "bun:test" {
|
|
|
1172
1203
|
*
|
|
1173
1204
|
* @param expected the expected value
|
|
1174
1205
|
*/
|
|
1175
|
-
toContainEqual(expected:
|
|
1206
|
+
toContainEqual(expected: T extends Iterable<infer U> ? U : T): void;
|
|
1207
|
+
toContainEqual<X = T>(expected: NoInfer<X extends Iterable<infer U> ? U : X>): void;
|
|
1208
|
+
|
|
1176
1209
|
/**
|
|
1177
1210
|
* Asserts that a value has a `.length` property
|
|
1178
1211
|
* that is equal to the expected length.
|
|
@@ -1184,6 +1217,7 @@ declare module "bun:test" {
|
|
|
1184
1217
|
* @param length the expected length
|
|
1185
1218
|
*/
|
|
1186
1219
|
toHaveLength(length: number): void;
|
|
1220
|
+
|
|
1187
1221
|
/**
|
|
1188
1222
|
* Asserts that a value has a property with the
|
|
1189
1223
|
* expected name, and value if provided.
|
|
@@ -1198,6 +1232,7 @@ declare module "bun:test" {
|
|
|
1198
1232
|
* @param value the expected property value, if provided
|
|
1199
1233
|
*/
|
|
1200
1234
|
toHaveProperty(keyPath: string | number | Array<string | number>, value?: unknown): void;
|
|
1235
|
+
|
|
1201
1236
|
/**
|
|
1202
1237
|
* Asserts that a value is "truthy".
|
|
1203
1238
|
*
|
|
@@ -1210,6 +1245,7 @@ declare module "bun:test" {
|
|
|
1210
1245
|
* expect({}).toBeTruthy();
|
|
1211
1246
|
*/
|
|
1212
1247
|
toBeTruthy(): void;
|
|
1248
|
+
|
|
1213
1249
|
/**
|
|
1214
1250
|
* Asserts that a value is "falsy".
|
|
1215
1251
|
*
|
|
@@ -1222,6 +1258,7 @@ declare module "bun:test" {
|
|
|
1222
1258
|
* expect({}).toBeTruthy();
|
|
1223
1259
|
*/
|
|
1224
1260
|
toBeFalsy(): void;
|
|
1261
|
+
|
|
1225
1262
|
/**
|
|
1226
1263
|
* Asserts that a value is defined. (e.g. is not `undefined`)
|
|
1227
1264
|
*
|
|
@@ -1230,6 +1267,7 @@ declare module "bun:test" {
|
|
|
1230
1267
|
* expect(undefined).toBeDefined(); // fail
|
|
1231
1268
|
*/
|
|
1232
1269
|
toBeDefined(): void;
|
|
1270
|
+
|
|
1233
1271
|
/**
|
|
1234
1272
|
* Asserts that the expected value is an instance of value
|
|
1235
1273
|
*
|
|
@@ -1238,6 +1276,7 @@ declare module "bun:test" {
|
|
|
1238
1276
|
* expect(null).toBeInstanceOf(Array); // fail
|
|
1239
1277
|
*/
|
|
1240
1278
|
toBeInstanceOf(value: unknown): void;
|
|
1279
|
+
|
|
1241
1280
|
/**
|
|
1242
1281
|
* Asserts that a value is `undefined`.
|
|
1243
1282
|
*
|
|
@@ -1246,6 +1285,7 @@ declare module "bun:test" {
|
|
|
1246
1285
|
* expect(null).toBeUndefined(); // fail
|
|
1247
1286
|
*/
|
|
1248
1287
|
toBeUndefined(): void;
|
|
1288
|
+
|
|
1249
1289
|
/**
|
|
1250
1290
|
* Asserts that a value is `null`.
|
|
1251
1291
|
*
|
|
@@ -1254,6 +1294,7 @@ declare module "bun:test" {
|
|
|
1254
1294
|
* expect(undefined).toBeNull(); // fail
|
|
1255
1295
|
*/
|
|
1256
1296
|
toBeNull(): void;
|
|
1297
|
+
|
|
1257
1298
|
/**
|
|
1258
1299
|
* Asserts that a value is `NaN`.
|
|
1259
1300
|
*
|
|
@@ -1265,6 +1306,7 @@ declare module "bun:test" {
|
|
|
1265
1306
|
* expect("notanumber").toBeNaN(); // fail
|
|
1266
1307
|
*/
|
|
1267
1308
|
toBeNaN(): void;
|
|
1309
|
+
|
|
1268
1310
|
/**
|
|
1269
1311
|
* Asserts that a value is a `number` and is greater than the expected value.
|
|
1270
1312
|
*
|
|
@@ -1276,6 +1318,7 @@ declare module "bun:test" {
|
|
|
1276
1318
|
* @param expected the expected number
|
|
1277
1319
|
*/
|
|
1278
1320
|
toBeGreaterThan(expected: number | bigint): void;
|
|
1321
|
+
|
|
1279
1322
|
/**
|
|
1280
1323
|
* Asserts that a value is a `number` and is greater than or equal to the expected value.
|
|
1281
1324
|
*
|
|
@@ -1287,6 +1330,7 @@ declare module "bun:test" {
|
|
|
1287
1330
|
* @param expected the expected number
|
|
1288
1331
|
*/
|
|
1289
1332
|
toBeGreaterThanOrEqual(expected: number | bigint): void;
|
|
1333
|
+
|
|
1290
1334
|
/**
|
|
1291
1335
|
* Asserts that a value is a `number` and is less than the expected value.
|
|
1292
1336
|
*
|
|
@@ -1298,6 +1342,7 @@ declare module "bun:test" {
|
|
|
1298
1342
|
* @param expected the expected number
|
|
1299
1343
|
*/
|
|
1300
1344
|
toBeLessThan(expected: number | bigint): void;
|
|
1345
|
+
|
|
1301
1346
|
/**
|
|
1302
1347
|
* Asserts that a value is a `number` and is less than or equal to the expected value.
|
|
1303
1348
|
*
|
|
@@ -1309,6 +1354,7 @@ declare module "bun:test" {
|
|
|
1309
1354
|
* @param expected the expected number
|
|
1310
1355
|
*/
|
|
1311
1356
|
toBeLessThanOrEqual(expected: number | bigint): void;
|
|
1357
|
+
|
|
1312
1358
|
/**
|
|
1313
1359
|
* Asserts that a function throws an error.
|
|
1314
1360
|
*
|
|
@@ -1329,6 +1375,7 @@ declare module "bun:test" {
|
|
|
1329
1375
|
* @param expected the expected error, error message, or error pattern
|
|
1330
1376
|
*/
|
|
1331
1377
|
toThrow(expected?: unknown): void;
|
|
1378
|
+
|
|
1332
1379
|
/**
|
|
1333
1380
|
* Asserts that a function throws an error.
|
|
1334
1381
|
*
|
|
@@ -1350,6 +1397,7 @@ declare module "bun:test" {
|
|
|
1350
1397
|
* @alias toThrow
|
|
1351
1398
|
*/
|
|
1352
1399
|
toThrowError(expected?: unknown): void;
|
|
1400
|
+
|
|
1353
1401
|
/**
|
|
1354
1402
|
* Asserts that a value matches a regular expression or includes a substring.
|
|
1355
1403
|
*
|
|
@@ -1360,6 +1408,7 @@ declare module "bun:test" {
|
|
|
1360
1408
|
* @param expected the expected substring or pattern.
|
|
1361
1409
|
*/
|
|
1362
1410
|
toMatch(expected: string | RegExp): void;
|
|
1411
|
+
|
|
1363
1412
|
/**
|
|
1364
1413
|
* Asserts that a value matches the most recent snapshot.
|
|
1365
1414
|
*
|
|
@@ -1368,6 +1417,7 @@ declare module "bun:test" {
|
|
|
1368
1417
|
* @param hint Hint used to identify the snapshot in the snapshot file.
|
|
1369
1418
|
*/
|
|
1370
1419
|
toMatchSnapshot(hint?: string): void;
|
|
1420
|
+
|
|
1371
1421
|
/**
|
|
1372
1422
|
* Asserts that a value matches the most recent snapshot.
|
|
1373
1423
|
*
|
|
@@ -1380,6 +1430,7 @@ declare module "bun:test" {
|
|
|
1380
1430
|
* @param hint Hint used to identify the snapshot in the snapshot file.
|
|
1381
1431
|
*/
|
|
1382
1432
|
toMatchSnapshot(propertyMatchers?: object, hint?: string): void;
|
|
1433
|
+
|
|
1383
1434
|
/**
|
|
1384
1435
|
* Asserts that a value matches the most recent inline snapshot.
|
|
1385
1436
|
*
|
|
@@ -1390,6 +1441,7 @@ declare module "bun:test" {
|
|
|
1390
1441
|
* @param value The latest automatically-updated snapshot value.
|
|
1391
1442
|
*/
|
|
1392
1443
|
toMatchInlineSnapshot(value?: string): void;
|
|
1444
|
+
|
|
1393
1445
|
/**
|
|
1394
1446
|
* Asserts that a value matches the most recent inline snapshot.
|
|
1395
1447
|
*
|
|
@@ -1405,6 +1457,7 @@ declare module "bun:test" {
|
|
|
1405
1457
|
* @param value The latest automatically-updated snapshot value.
|
|
1406
1458
|
*/
|
|
1407
1459
|
toMatchInlineSnapshot(propertyMatchers?: object, value?: string): void;
|
|
1460
|
+
|
|
1408
1461
|
/**
|
|
1409
1462
|
* Asserts that a function throws an error matching the most recent snapshot.
|
|
1410
1463
|
*
|
|
@@ -1418,6 +1471,7 @@ declare module "bun:test" {
|
|
|
1418
1471
|
* @param value The latest automatically-updated snapshot value.
|
|
1419
1472
|
*/
|
|
1420
1473
|
toThrowErrorMatchingSnapshot(hint?: string): void;
|
|
1474
|
+
|
|
1421
1475
|
/**
|
|
1422
1476
|
* Asserts that a function throws an error matching the most recent snapshot.
|
|
1423
1477
|
*
|
|
@@ -1431,6 +1485,7 @@ declare module "bun:test" {
|
|
|
1431
1485
|
* @param value The latest automatically-updated snapshot value.
|
|
1432
1486
|
*/
|
|
1433
1487
|
toThrowErrorMatchingInlineSnapshot(value?: string): void;
|
|
1488
|
+
|
|
1434
1489
|
/**
|
|
1435
1490
|
* Asserts that an object matches a subset of properties.
|
|
1436
1491
|
*
|
|
@@ -1441,6 +1496,7 @@ declare module "bun:test" {
|
|
|
1441
1496
|
* @param subset Subset of properties to match with.
|
|
1442
1497
|
*/
|
|
1443
1498
|
toMatchObject(subset: object): void;
|
|
1499
|
+
|
|
1444
1500
|
/**
|
|
1445
1501
|
* Asserts that a value is empty.
|
|
1446
1502
|
*
|
|
@@ -1451,6 +1507,7 @@ declare module "bun:test" {
|
|
|
1451
1507
|
* expect(new Set()).toBeEmpty();
|
|
1452
1508
|
*/
|
|
1453
1509
|
toBeEmpty(): void;
|
|
1510
|
+
|
|
1454
1511
|
/**
|
|
1455
1512
|
* Asserts that a value is an empty `object`.
|
|
1456
1513
|
*
|
|
@@ -1459,6 +1516,7 @@ declare module "bun:test" {
|
|
|
1459
1516
|
* expect({ a: 'hello' }).not.toBeEmptyObject();
|
|
1460
1517
|
*/
|
|
1461
1518
|
toBeEmptyObject(): void;
|
|
1519
|
+
|
|
1462
1520
|
/**
|
|
1463
1521
|
* Asserts that a value is `null` or `undefined`.
|
|
1464
1522
|
*
|
|
@@ -1467,6 +1525,7 @@ declare module "bun:test" {
|
|
|
1467
1525
|
* expect(undefined).toBeNil();
|
|
1468
1526
|
*/
|
|
1469
1527
|
toBeNil(): void;
|
|
1528
|
+
|
|
1470
1529
|
/**
|
|
1471
1530
|
* Asserts that a value is a `array`.
|
|
1472
1531
|
*
|
|
@@ -1477,6 +1536,7 @@ declare module "bun:test" {
|
|
|
1477
1536
|
* expect({}).not.toBeArray();
|
|
1478
1537
|
*/
|
|
1479
1538
|
toBeArray(): void;
|
|
1539
|
+
|
|
1480
1540
|
/**
|
|
1481
1541
|
* Asserts that a value is a `array` of a certain length.
|
|
1482
1542
|
*
|
|
@@ -1488,6 +1548,7 @@ declare module "bun:test" {
|
|
|
1488
1548
|
* expect({}).not.toBeArrayOfSize(0);
|
|
1489
1549
|
*/
|
|
1490
1550
|
toBeArrayOfSize(size: number): void;
|
|
1551
|
+
|
|
1491
1552
|
/**
|
|
1492
1553
|
* Asserts that a value is a `boolean`.
|
|
1493
1554
|
*
|
|
@@ -1498,6 +1559,7 @@ declare module "bun:test" {
|
|
|
1498
1559
|
* expect(0).not.toBeBoolean();
|
|
1499
1560
|
*/
|
|
1500
1561
|
toBeBoolean(): void;
|
|
1562
|
+
|
|
1501
1563
|
/**
|
|
1502
1564
|
* Asserts that a value is `true`.
|
|
1503
1565
|
*
|
|
@@ -1507,6 +1569,7 @@ declare module "bun:test" {
|
|
|
1507
1569
|
* expect(1).not.toBeTrue();
|
|
1508
1570
|
*/
|
|
1509
1571
|
toBeTrue(): void;
|
|
1572
|
+
|
|
1510
1573
|
/**
|
|
1511
1574
|
* Asserts that a value matches a specific type.
|
|
1512
1575
|
*
|
|
@@ -1517,6 +1580,7 @@ declare module "bun:test" {
|
|
|
1517
1580
|
* expect([]).not.toBeTypeOf("boolean");
|
|
1518
1581
|
*/
|
|
1519
1582
|
toBeTypeOf(type: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined"): void;
|
|
1583
|
+
|
|
1520
1584
|
/**
|
|
1521
1585
|
* Asserts that a value is `false`.
|
|
1522
1586
|
*
|
|
@@ -1526,6 +1590,7 @@ declare module "bun:test" {
|
|
|
1526
1590
|
* expect(0).not.toBeFalse();
|
|
1527
1591
|
*/
|
|
1528
1592
|
toBeFalse(): void;
|
|
1593
|
+
|
|
1529
1594
|
/**
|
|
1530
1595
|
* Asserts that a value is a `number`.
|
|
1531
1596
|
*
|
|
@@ -1536,6 +1601,7 @@ declare module "bun:test" {
|
|
|
1536
1601
|
* expect(BigInt(1)).not.toBeNumber();
|
|
1537
1602
|
*/
|
|
1538
1603
|
toBeNumber(): void;
|
|
1604
|
+
|
|
1539
1605
|
/**
|
|
1540
1606
|
* Asserts that a value is a `number`, and is an integer.
|
|
1541
1607
|
*
|
|
@@ -1545,6 +1611,7 @@ declare module "bun:test" {
|
|
|
1545
1611
|
* expect(NaN).not.toBeInteger();
|
|
1546
1612
|
*/
|
|
1547
1613
|
toBeInteger(): void;
|
|
1614
|
+
|
|
1548
1615
|
/**
|
|
1549
1616
|
* Asserts that a value is an `object`.
|
|
1550
1617
|
*
|
|
@@ -1554,6 +1621,7 @@ declare module "bun:test" {
|
|
|
1554
1621
|
* expect(NaN).not.toBeObject();
|
|
1555
1622
|
*/
|
|
1556
1623
|
toBeObject(): void;
|
|
1624
|
+
|
|
1557
1625
|
/**
|
|
1558
1626
|
* Asserts that a value is a `number`, and is not `NaN` or `Infinity`.
|
|
1559
1627
|
*
|
|
@@ -1564,6 +1632,7 @@ declare module "bun:test" {
|
|
|
1564
1632
|
* expect(Infinity).not.toBeFinite();
|
|
1565
1633
|
*/
|
|
1566
1634
|
toBeFinite(): void;
|
|
1635
|
+
|
|
1567
1636
|
/**
|
|
1568
1637
|
* Asserts that a value is a positive `number`.
|
|
1569
1638
|
*
|
|
@@ -1573,6 +1642,7 @@ declare module "bun:test" {
|
|
|
1573
1642
|
* expect(NaN).not.toBePositive();
|
|
1574
1643
|
*/
|
|
1575
1644
|
toBePositive(): void;
|
|
1645
|
+
|
|
1576
1646
|
/**
|
|
1577
1647
|
* Asserts that a value is a negative `number`.
|
|
1578
1648
|
*
|
|
@@ -1582,6 +1652,7 @@ declare module "bun:test" {
|
|
|
1582
1652
|
* expect(NaN).not.toBeNegative();
|
|
1583
1653
|
*/
|
|
1584
1654
|
toBeNegative(): void;
|
|
1655
|
+
|
|
1585
1656
|
/**
|
|
1586
1657
|
* Asserts that a value is a number between a start and end value.
|
|
1587
1658
|
*
|
|
@@ -1589,6 +1660,7 @@ declare module "bun:test" {
|
|
|
1589
1660
|
* @param end the end number (exclusive)
|
|
1590
1661
|
*/
|
|
1591
1662
|
toBeWithin(start: number, end: number): void;
|
|
1663
|
+
|
|
1592
1664
|
/**
|
|
1593
1665
|
* Asserts that a value is equal to the expected string, ignoring any whitespace.
|
|
1594
1666
|
*
|
|
@@ -1599,6 +1671,7 @@ declare module "bun:test" {
|
|
|
1599
1671
|
* @param expected the expected string
|
|
1600
1672
|
*/
|
|
1601
1673
|
toEqualIgnoringWhitespace(expected: string): void;
|
|
1674
|
+
|
|
1602
1675
|
/**
|
|
1603
1676
|
* Asserts that a value is a `symbol`.
|
|
1604
1677
|
*
|
|
@@ -1607,6 +1680,7 @@ declare module "bun:test" {
|
|
|
1607
1680
|
* expect("foo").not.toBeSymbol();
|
|
1608
1681
|
*/
|
|
1609
1682
|
toBeSymbol(): void;
|
|
1683
|
+
|
|
1610
1684
|
/**
|
|
1611
1685
|
* Asserts that a value is a `function`.
|
|
1612
1686
|
*
|
|
@@ -1614,6 +1688,7 @@ declare module "bun:test" {
|
|
|
1614
1688
|
* expect(() => {}).toBeFunction();
|
|
1615
1689
|
*/
|
|
1616
1690
|
toBeFunction(): void;
|
|
1691
|
+
|
|
1617
1692
|
/**
|
|
1618
1693
|
* Asserts that a value is a `Date` object.
|
|
1619
1694
|
*
|
|
@@ -1625,6 +1700,7 @@ declare module "bun:test" {
|
|
|
1625
1700
|
* expect("2020-03-01").not.toBeDate();
|
|
1626
1701
|
*/
|
|
1627
1702
|
toBeDate(): void;
|
|
1703
|
+
|
|
1628
1704
|
/**
|
|
1629
1705
|
* Asserts that a value is a valid `Date` object.
|
|
1630
1706
|
*
|
|
@@ -1634,6 +1710,7 @@ declare module "bun:test" {
|
|
|
1634
1710
|
* expect("2020-03-01").not.toBeValidDate();
|
|
1635
1711
|
*/
|
|
1636
1712
|
toBeValidDate(): void;
|
|
1713
|
+
|
|
1637
1714
|
/**
|
|
1638
1715
|
* Asserts that a value is a `string`.
|
|
1639
1716
|
*
|
|
@@ -1643,6 +1720,7 @@ declare module "bun:test" {
|
|
|
1643
1720
|
* expect(123).not.toBeString();
|
|
1644
1721
|
*/
|
|
1645
1722
|
toBeString(): void;
|
|
1723
|
+
|
|
1646
1724
|
/**
|
|
1647
1725
|
* Asserts that a value includes a `string`.
|
|
1648
1726
|
*
|
|
@@ -1651,12 +1729,14 @@ declare module "bun:test" {
|
|
|
1651
1729
|
* @param expected the expected substring
|
|
1652
1730
|
*/
|
|
1653
1731
|
toInclude(expected: string): void;
|
|
1732
|
+
|
|
1654
1733
|
/**
|
|
1655
1734
|
* Asserts that a value includes a `string` {times} times.
|
|
1656
1735
|
* @param expected the expected substring
|
|
1657
1736
|
* @param times the number of times the substring should occur
|
|
1658
1737
|
*/
|
|
1659
1738
|
toIncludeRepeated(expected: string, times: number): void;
|
|
1739
|
+
|
|
1660
1740
|
/**
|
|
1661
1741
|
* Checks whether a value satisfies a custom condition.
|
|
1662
1742
|
* @param {Function} predicate - The custom condition to be satisfied. It should be a function that takes a value as an argument (in this case the value from expect) and returns a boolean.
|
|
@@ -1668,18 +1748,21 @@ declare module "bun:test" {
|
|
|
1668
1748
|
* @link https://jest-extended.jestcommunity.dev/docs/matchers/toSatisfy
|
|
1669
1749
|
*/
|
|
1670
1750
|
toSatisfy(predicate: (value: T) => boolean): void;
|
|
1751
|
+
|
|
1671
1752
|
/**
|
|
1672
1753
|
* Asserts that a value starts with a `string`.
|
|
1673
1754
|
*
|
|
1674
1755
|
* @param expected the string to start with
|
|
1675
1756
|
*/
|
|
1676
1757
|
toStartWith(expected: string): void;
|
|
1758
|
+
|
|
1677
1759
|
/**
|
|
1678
1760
|
* Asserts that a value ends with a `string`.
|
|
1679
1761
|
*
|
|
1680
1762
|
* @param expected the string to end with
|
|
1681
1763
|
*/
|
|
1682
1764
|
toEndWith(expected: string): void;
|
|
1765
|
+
|
|
1683
1766
|
/**
|
|
1684
1767
|
* Ensures that a mock function has returned successfully at least once.
|
|
1685
1768
|
*
|
|
@@ -1720,42 +1803,51 @@ declare module "bun:test" {
|
|
|
1720
1803
|
* Ensures that a mock function is called.
|
|
1721
1804
|
*/
|
|
1722
1805
|
toHaveBeenCalled(): void;
|
|
1806
|
+
|
|
1723
1807
|
/**
|
|
1724
1808
|
* Ensures that a mock function is called an exact number of times.
|
|
1725
1809
|
* @alias toHaveBeenCalled
|
|
1726
1810
|
*/
|
|
1727
1811
|
toBeCalled(): void;
|
|
1812
|
+
|
|
1728
1813
|
/**
|
|
1729
1814
|
* Ensures that a mock function is called an exact number of times.
|
|
1730
1815
|
*/
|
|
1731
1816
|
toHaveBeenCalledTimes(expected: number): void;
|
|
1817
|
+
|
|
1732
1818
|
/**
|
|
1733
1819
|
* Ensure that a mock function is called with specific arguments.
|
|
1734
1820
|
* @alias toHaveBeenCalledTimes
|
|
1735
1821
|
*/
|
|
1736
1822
|
toBeCalledTimes(expected: number): void;
|
|
1823
|
+
|
|
1737
1824
|
/**
|
|
1738
1825
|
* Ensure that a mock function is called with specific arguments.
|
|
1739
1826
|
*/
|
|
1740
1827
|
toHaveBeenCalledWith(...expected: unknown[]): void;
|
|
1828
|
+
|
|
1741
1829
|
/**
|
|
1742
1830
|
* Ensure that a mock function is called with specific arguments.
|
|
1743
1831
|
* @alias toHaveBeenCalledWith
|
|
1744
1832
|
*/
|
|
1745
1833
|
toBeCalledWith(...expected: unknown[]): void;
|
|
1834
|
+
|
|
1746
1835
|
/**
|
|
1747
1836
|
* Ensure that a mock function is called with specific arguments for the last call.
|
|
1748
1837
|
*/
|
|
1749
1838
|
toHaveBeenLastCalledWith(...expected: unknown[]): void;
|
|
1839
|
+
|
|
1750
1840
|
/**
|
|
1751
1841
|
* Ensure that a mock function is called with specific arguments for the nth call.
|
|
1752
1842
|
* @alias toHaveBeenCalledWith
|
|
1753
1843
|
*/
|
|
1754
1844
|
lastCalledWith(...expected: unknown[]): void;
|
|
1845
|
+
|
|
1755
1846
|
/**
|
|
1756
1847
|
* Ensure that a mock function is called with specific arguments for the nth call.
|
|
1757
1848
|
*/
|
|
1758
1849
|
toHaveBeenNthCalledWith(n: number, ...expected: unknown[]): void;
|
|
1850
|
+
|
|
1759
1851
|
/**
|
|
1760
1852
|
* Ensure that a mock function is called with specific arguments for the nth call.
|
|
1761
1853
|
* @alias toHaveBeenCalledWith
|