bun-types 1.2.23-canary.20250918T140651 → 1.2.23-canary.20250920T140621
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 +12 -0
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/cli/pm.md +1 -1
- package/docs/cli/publish.md +1 -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/package.json +1 -1
- package/test.d.ts +70 -106
package/bun.d.ts
CHANGED
|
@@ -1899,6 +1899,18 @@ declare module "bun" {
|
|
|
1899
1899
|
*/
|
|
1900
1900
|
tsconfig?: string;
|
|
1901
1901
|
|
|
1902
|
+
/**
|
|
1903
|
+
* JSX configuration options
|
|
1904
|
+
*/
|
|
1905
|
+
jsx?: {
|
|
1906
|
+
runtime?: "automatic" | "classic";
|
|
1907
|
+
importSource?: string;
|
|
1908
|
+
factory?: string;
|
|
1909
|
+
fragment?: string;
|
|
1910
|
+
sideEffects?: boolean;
|
|
1911
|
+
development?: boolean;
|
|
1912
|
+
};
|
|
1913
|
+
|
|
1902
1914
|
outdir?: string;
|
|
1903
1915
|
}
|
|
1904
1916
|
|
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.23-canary.
|
|
339
|
+
[fetch] > User-Agent: Bun/1.2.23-canary.20250920T140621
|
|
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.23-canary.
|
|
143
|
+
console.log(text); // => "1.2.23-canary.20250920T140621\n"
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
Configure the output stream by passing one of the following values to `stdout/stderr`:
|
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.23-canary.
|
|
216
|
+
bun pm version v1.2.23-canary.20250920T140621 (ca7428e9)
|
|
217
217
|
Current package version: v1.0.0
|
|
218
218
|
|
|
219
219
|
Increment:
|
package/docs/cli/publish.md
CHANGED
|
@@ -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.23-canary.
|
|
12
|
+
bun install v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
18
|
+
+ "@types/bun": "^1.2.23-canary.20250920T140621"
|
|
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.23-canary.
|
|
30
|
+
"@types/bun": "^1.2.23-canary.20250920T140621"
|
|
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.23-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.23-canary.20250920T140621
|
|
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.23-canary.
|
|
24
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
50
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
88
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
21
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
64
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
81
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
32
|
+
bun test v1.2.23-canary.20250920T140621 (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.23-canary.
|
|
17
|
+
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250920T140621"
|
|
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.23-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.23-canary.20250920T140621`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.
|
|
195
|
+
$ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250920T140621"
|
|
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.23-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.23-canary.20250920T140621"
|
|
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.23-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.23-canary.20250920T140621" -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.23-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.23-canary.20250920T140621
|
|
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.23-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.23-canary.20250920T140621
|
|
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/package.json
CHANGED
package/test.d.ts
CHANGED
|
@@ -206,31 +206,26 @@ declare module "bun:test" {
|
|
|
206
206
|
*
|
|
207
207
|
* @category Testing
|
|
208
208
|
*/
|
|
209
|
-
export interface Describe {
|
|
209
|
+
export interface Describe<T extends Readonly<any[]>> {
|
|
210
210
|
(fn: () => void): void;
|
|
211
211
|
|
|
212
|
-
(label: DescribeLabel, fn: () => void): void;
|
|
212
|
+
(label: DescribeLabel, fn: (...args: T) => void): void;
|
|
213
213
|
/**
|
|
214
214
|
* Skips all other tests, except this group of tests.
|
|
215
|
-
*
|
|
216
|
-
* @param label the label for the tests
|
|
217
|
-
* @param fn the function that defines the tests
|
|
218
215
|
*/
|
|
219
|
-
only
|
|
216
|
+
only: Describe<T>;
|
|
220
217
|
/**
|
|
221
218
|
* Skips this group of tests.
|
|
222
|
-
*
|
|
223
|
-
* @param label the label for the tests
|
|
224
|
-
* @param fn the function that defines the tests
|
|
225
219
|
*/
|
|
226
|
-
skip
|
|
220
|
+
skip: Describe<T>;
|
|
227
221
|
/**
|
|
228
222
|
* Marks this group of tests as to be written or to be fixed.
|
|
229
|
-
*
|
|
230
|
-
* @param label the label for the tests
|
|
231
|
-
* @param fn the function that defines the tests
|
|
232
223
|
*/
|
|
233
|
-
todo
|
|
224
|
+
todo: Describe<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Marks this group of tests to be executed concurrently.
|
|
227
|
+
*/
|
|
228
|
+
concurrent: Describe<T>;
|
|
234
229
|
/**
|
|
235
230
|
* Runs this group of tests, only if `condition` is true.
|
|
236
231
|
*
|
|
@@ -238,37 +233,27 @@ declare module "bun:test" {
|
|
|
238
233
|
*
|
|
239
234
|
* @param condition if these tests should run
|
|
240
235
|
*/
|
|
241
|
-
if(condition: boolean):
|
|
236
|
+
if(condition: boolean): Describe<T>;
|
|
242
237
|
/**
|
|
243
238
|
* Skips this group of tests, if `condition` is true.
|
|
244
239
|
*
|
|
245
240
|
* @param condition if these tests should be skipped
|
|
246
241
|
*/
|
|
247
|
-
skipIf(condition: boolean):
|
|
242
|
+
skipIf(condition: boolean): Describe<T>;
|
|
248
243
|
/**
|
|
249
244
|
* Marks this group of tests as to be written or to be fixed, if `condition` is true.
|
|
250
245
|
*
|
|
251
246
|
* @param condition if these tests should be skipped
|
|
252
247
|
*/
|
|
253
|
-
todoIf(condition: boolean):
|
|
248
|
+
todoIf(condition: boolean): Describe<T>;
|
|
254
249
|
/**
|
|
255
250
|
* Returns a function that runs for each item in `table`.
|
|
256
251
|
*
|
|
257
252
|
* @param table Array of Arrays with the arguments that are passed into the test fn for each row.
|
|
258
253
|
*/
|
|
259
|
-
each<T extends Readonly<[any, ...any[]]>>(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
each<T extends any[]>(
|
|
263
|
-
table: readonly T[],
|
|
264
|
-
): (
|
|
265
|
-
label: DescribeLabel,
|
|
266
|
-
fn: (...args: Readonly<T>) => void | Promise<unknown>,
|
|
267
|
-
options?: number | TestOptions,
|
|
268
|
-
) => void;
|
|
269
|
-
each<T>(
|
|
270
|
-
table: T[],
|
|
271
|
-
): (label: DescribeLabel, fn: (...args: T[]) => void | Promise<unknown>, options?: number | TestOptions) => void;
|
|
254
|
+
each<T extends Readonly<[any, ...any[]]>>(table: readonly T[]): Describe<[...T]>;
|
|
255
|
+
each<T extends any[]>(table: readonly T[]): Describe<[...T]>;
|
|
256
|
+
each<T>(table: T[]): Describe<[T]>;
|
|
272
257
|
}
|
|
273
258
|
/**
|
|
274
259
|
* Describes a group of related tests.
|
|
@@ -286,7 +271,7 @@ declare module "bun:test" {
|
|
|
286
271
|
* @param label the label for the tests
|
|
287
272
|
* @param fn the function that defines the tests
|
|
288
273
|
*/
|
|
289
|
-
export const describe: Describe
|
|
274
|
+
export const describe: Describe<[]>;
|
|
290
275
|
/**
|
|
291
276
|
* Skips a group of related tests.
|
|
292
277
|
*
|
|
@@ -295,7 +280,9 @@ declare module "bun:test" {
|
|
|
295
280
|
* @param label the label for the tests
|
|
296
281
|
* @param fn the function that defines the tests
|
|
297
282
|
*/
|
|
298
|
-
export const xdescribe: Describe
|
|
283
|
+
export const xdescribe: Describe<[]>;
|
|
284
|
+
|
|
285
|
+
type HookOptions = number | { timeout?: number };
|
|
299
286
|
/**
|
|
300
287
|
* Runs a function, once, before all the tests.
|
|
301
288
|
*
|
|
@@ -312,7 +299,10 @@ declare module "bun:test" {
|
|
|
312
299
|
*
|
|
313
300
|
* @param fn the function to run
|
|
314
301
|
*/
|
|
315
|
-
export function beforeAll(
|
|
302
|
+
export function beforeAll(
|
|
303
|
+
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
304
|
+
options?: HookOptions,
|
|
305
|
+
): void;
|
|
316
306
|
/**
|
|
317
307
|
* Runs a function before each test.
|
|
318
308
|
*
|
|
@@ -323,7 +313,10 @@ declare module "bun:test" {
|
|
|
323
313
|
*
|
|
324
314
|
* @param fn the function to run
|
|
325
315
|
*/
|
|
326
|
-
export function beforeEach(
|
|
316
|
+
export function beforeEach(
|
|
317
|
+
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
318
|
+
options?: HookOptions,
|
|
319
|
+
): void;
|
|
327
320
|
/**
|
|
328
321
|
* Runs a function, once, after all the tests.
|
|
329
322
|
*
|
|
@@ -340,7 +333,10 @@ declare module "bun:test" {
|
|
|
340
333
|
*
|
|
341
334
|
* @param fn the function to run
|
|
342
335
|
*/
|
|
343
|
-
export function afterAll(
|
|
336
|
+
export function afterAll(
|
|
337
|
+
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
338
|
+
options?: HookOptions,
|
|
339
|
+
): void;
|
|
344
340
|
/**
|
|
345
341
|
* Runs a function after each test.
|
|
346
342
|
*
|
|
@@ -349,7 +345,10 @@ declare module "bun:test" {
|
|
|
349
345
|
*
|
|
350
346
|
* @param fn the function to run
|
|
351
347
|
*/
|
|
352
|
-
export function afterEach(
|
|
348
|
+
export function afterEach(
|
|
349
|
+
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
350
|
+
options?: HookOptions,
|
|
351
|
+
): void;
|
|
353
352
|
/**
|
|
354
353
|
* Sets the default timeout for all tests in the current file. If a test specifies a timeout, it will
|
|
355
354
|
* override this value. The default timeout is 5000ms (5 seconds).
|
|
@@ -382,6 +381,11 @@ declare module "bun:test" {
|
|
|
382
381
|
*/
|
|
383
382
|
repeats?: number;
|
|
384
383
|
}
|
|
384
|
+
type IsTuple<T> = T extends readonly unknown[]
|
|
385
|
+
? number extends T["length"]
|
|
386
|
+
? false // It's an array with unknown length, not a tuple
|
|
387
|
+
: true // It's an array with a fixed length (a tuple)
|
|
388
|
+
: false; // Not an array at all
|
|
385
389
|
/**
|
|
386
390
|
* Runs a test.
|
|
387
391
|
*
|
|
@@ -405,10 +409,10 @@ declare module "bun:test" {
|
|
|
405
409
|
*
|
|
406
410
|
* @category Testing
|
|
407
411
|
*/
|
|
408
|
-
export interface Test {
|
|
412
|
+
export interface Test<T extends Readonly<any[]>> {
|
|
409
413
|
(
|
|
410
414
|
label: string,
|
|
411
|
-
fn: (
|
|
415
|
+
fn: (...args: IsTuple<T> extends true ? [...T, (err?: unknown) => void] : T) => void | Promise<unknown>,
|
|
412
416
|
/**
|
|
413
417
|
* - If a `number`, sets the timeout for the test in milliseconds.
|
|
414
418
|
* - If an `object`, sets the options for the test.
|
|
@@ -420,28 +424,12 @@ declare module "bun:test" {
|
|
|
420
424
|
): void;
|
|
421
425
|
/**
|
|
422
426
|
* Skips all other tests, except this test when run with the `--only` option.
|
|
423
|
-
*
|
|
424
|
-
* @param label the label for the test
|
|
425
|
-
* @param fn the test function
|
|
426
|
-
* @param options the test timeout or options
|
|
427
427
|
*/
|
|
428
|
-
only
|
|
429
|
-
label: string,
|
|
430
|
-
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
431
|
-
options?: number | TestOptions,
|
|
432
|
-
): void;
|
|
428
|
+
only: Test<T>;
|
|
433
429
|
/**
|
|
434
430
|
* Skips this test.
|
|
435
|
-
*
|
|
436
|
-
* @param label the label for the test
|
|
437
|
-
* @param fn the test function
|
|
438
|
-
* @param options the test timeout or options
|
|
439
431
|
*/
|
|
440
|
-
skip
|
|
441
|
-
label: string,
|
|
442
|
-
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
443
|
-
options?: number | TestOptions,
|
|
444
|
-
): void;
|
|
432
|
+
skip: Test<T>;
|
|
445
433
|
/**
|
|
446
434
|
* Marks this test as to be written or to be fixed.
|
|
447
435
|
*
|
|
@@ -449,16 +437,8 @@ declare module "bun:test" {
|
|
|
449
437
|
* if the test passes, the test will be marked as `fail` in the results; you will have to
|
|
450
438
|
* remove the `.todo` or check that your test
|
|
451
439
|
* is implemented correctly.
|
|
452
|
-
*
|
|
453
|
-
* @param label the label for the test
|
|
454
|
-
* @param fn the test function
|
|
455
|
-
* @param options the test timeout or options
|
|
456
440
|
*/
|
|
457
|
-
todo
|
|
458
|
-
label: string,
|
|
459
|
-
fn?: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
460
|
-
options?: number | TestOptions,
|
|
461
|
-
): void;
|
|
441
|
+
todo: Test<T>;
|
|
462
442
|
/**
|
|
463
443
|
* Marks this test as failing.
|
|
464
444
|
*
|
|
@@ -469,16 +449,12 @@ declare module "bun:test" {
|
|
|
469
449
|
*
|
|
470
450
|
* `test.failing` is very similar to {@link test.todo} except that it always
|
|
471
451
|
* runs, regardless of the `--todo` flag.
|
|
472
|
-
*
|
|
473
|
-
* @param label the label for the test
|
|
474
|
-
* @param fn the test function
|
|
475
|
-
* @param options the test timeout or options
|
|
476
452
|
*/
|
|
477
|
-
failing
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
453
|
+
failing: Test<T>;
|
|
454
|
+
/**
|
|
455
|
+
* Runs the test concurrently with other concurrent tests.
|
|
456
|
+
*/
|
|
457
|
+
concurrent: Test<T>;
|
|
482
458
|
/**
|
|
483
459
|
* Runs this test, if `condition` is true.
|
|
484
460
|
*
|
|
@@ -486,51 +462,39 @@ declare module "bun:test" {
|
|
|
486
462
|
*
|
|
487
463
|
* @param condition if the test should run
|
|
488
464
|
*/
|
|
489
|
-
if(
|
|
490
|
-
condition: boolean,
|
|
491
|
-
): (
|
|
492
|
-
label: string,
|
|
493
|
-
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
494
|
-
options?: number | TestOptions,
|
|
495
|
-
) => void;
|
|
465
|
+
if(condition: boolean): Test<T>;
|
|
496
466
|
/**
|
|
497
467
|
* Skips this test, if `condition` is true.
|
|
498
468
|
*
|
|
499
469
|
* @param condition if the test should be skipped
|
|
500
470
|
*/
|
|
501
|
-
skipIf(
|
|
502
|
-
condition: boolean,
|
|
503
|
-
): (
|
|
504
|
-
label: string,
|
|
505
|
-
fn: (() => void | Promise<unknown>) | ((done: (err?: unknown) => void) => void),
|
|
506
|
-
options?: number | TestOptions,
|
|
507
|
-
) => void;
|
|
471
|
+
skipIf(condition: boolean): Test<T>;
|
|
508
472
|
/**
|
|
509
473
|
* Marks this test as to be written or to be fixed, if `condition` is true.
|
|
510
474
|
*
|
|
511
475
|
* @param condition if the test should be marked TODO
|
|
512
476
|
*/
|
|
513
|
-
todoIf(
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
)
|
|
477
|
+
todoIf(condition: boolean): Test<T>;
|
|
478
|
+
/**
|
|
479
|
+
* Marks this test as failing, if `condition` is true.
|
|
480
|
+
*
|
|
481
|
+
* @param condition if the test should be marked as failing
|
|
482
|
+
*/
|
|
483
|
+
failingIf(condition: boolean): Test<T>;
|
|
484
|
+
/**
|
|
485
|
+
* Runs the test concurrently with other concurrent tests, if `condition` is true.
|
|
486
|
+
*
|
|
487
|
+
* @param condition if the test should run concurrently
|
|
488
|
+
*/
|
|
489
|
+
concurrentIf(condition: boolean): Test<T>;
|
|
520
490
|
/**
|
|
521
491
|
* Returns a function that runs for each item in `table`.
|
|
522
492
|
*
|
|
523
493
|
* @param table Array of Arrays with the arguments that are passed into the test fn for each row.
|
|
524
494
|
*/
|
|
525
|
-
each<T extends Readonly<[any, ...any[]]>>(
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
each<T extends any[]>(
|
|
529
|
-
table: readonly T[],
|
|
530
|
-
): (label: string, fn: (...args: Readonly<T>) => void | Promise<unknown>, options?: number | TestOptions) => void;
|
|
531
|
-
each<T>(
|
|
532
|
-
table: T[],
|
|
533
|
-
): (label: string, fn: (...args: T[]) => void | Promise<unknown>, options?: number | TestOptions) => void;
|
|
495
|
+
each<T extends Readonly<[any, ...any[]]>>(table: readonly T[]): Test<[...T]>;
|
|
496
|
+
each<T extends any[]>(table: readonly T[]): Test<[...T]>;
|
|
497
|
+
each<T>(table: T[]): Test<[T]>;
|
|
534
498
|
}
|
|
535
499
|
/**
|
|
536
500
|
* Runs a test.
|
|
@@ -548,7 +512,7 @@ declare module "bun:test" {
|
|
|
548
512
|
* @param label the label for the test
|
|
549
513
|
* @param fn the test function
|
|
550
514
|
*/
|
|
551
|
-
export const test: Test
|
|
515
|
+
export const test: Test<[]>;
|
|
552
516
|
export { test as it, xtest as xit };
|
|
553
517
|
|
|
554
518
|
/**
|
|
@@ -559,7 +523,7 @@ declare module "bun:test" {
|
|
|
559
523
|
* @param label the label for the test
|
|
560
524
|
* @param fn the test function
|
|
561
525
|
*/
|
|
562
|
-
export const xtest: Test
|
|
526
|
+
export const xtest: Test<[]>;
|
|
563
527
|
|
|
564
528
|
/**
|
|
565
529
|
* Asserts that a value matches some criteria.
|