bun-types 1.1.39-canary.20241205T140550 → 1.1.39-canary.20241206T140546
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.
|
@@ -4,10 +4,6 @@ name: Use snapshot testing in `bun test`
|
|
|
4
4
|
|
|
5
5
|
Bun's test runner supports Jest-style snapshot testing via `.toMatchSnapshot()`.
|
|
6
6
|
|
|
7
|
-
{% callout %}
|
|
8
|
-
The `.toMatchInlineSnapshot()` method is not yet supported.
|
|
9
|
-
{% /callout %}
|
|
10
|
-
|
|
11
7
|
```ts#snap.test.ts
|
|
12
8
|
import { test, expect } from "bun:test";
|
|
13
9
|
|
|
@@ -96,4 +92,4 @@ Ran 1 tests across 1 files. [102.00ms]
|
|
|
96
92
|
|
|
97
93
|
---
|
|
98
94
|
|
|
99
|
-
See [Docs > Test Runner > Snapshots](https://bun.sh/docs/test/
|
|
95
|
+
See [Docs > Test Runner > Snapshots](https://bun.sh/docs/test/snapshots) for complete documentation on snapshots with the Bun test runner.
|
|
@@ -4,10 +4,6 @@ name: Update snapshots in `bun test`
|
|
|
4
4
|
|
|
5
5
|
Bun's test runner supports Jest-style snapshot testing via `.toMatchSnapshot()`.
|
|
6
6
|
|
|
7
|
-
{% callout %}
|
|
8
|
-
The `.toMatchInlineSnapshot()` method is not yet supported.
|
|
9
|
-
{% /callout %}
|
|
10
|
-
|
|
11
7
|
```ts#snap.test.ts
|
|
12
8
|
import { test, expect } from "bun:test";
|
|
13
9
|
|
|
@@ -47,4 +43,4 @@ Ran 1 tests across 1 files. [102.00ms]
|
|
|
47
43
|
|
|
48
44
|
---
|
|
49
45
|
|
|
50
|
-
See [Docs > Test Runner > Snapshots](https://bun.sh/docs/test/
|
|
46
|
+
See [Docs > Test Runner > Snapshots](https://bun.sh/docs/test/snapshots) for complete documentation on snapshots with the Bun test runner.
|
package/docs/test/writing.md
CHANGED
|
@@ -531,17 +531,17 @@ Bun implements the following matchers. Full Jest compatibility is on the roadmap
|
|
|
531
531
|
|
|
532
532
|
---
|
|
533
533
|
|
|
534
|
-
-
|
|
534
|
+
- ✅
|
|
535
535
|
- [`.toMatchInlineSnapshot()`](https://jestjs.io/docs/expect#tomatchinlinesnapshotpropertymatchers-inlinesnapshot)
|
|
536
536
|
|
|
537
537
|
---
|
|
538
538
|
|
|
539
|
-
-
|
|
539
|
+
- ✅
|
|
540
540
|
- [`.toThrowErrorMatchingSnapshot()`](https://jestjs.io/docs/expect#tothrowerrormatchingsnapshothint)
|
|
541
541
|
|
|
542
542
|
---
|
|
543
543
|
|
|
544
|
-
-
|
|
544
|
+
- ✅
|
|
545
545
|
- [`.toThrowErrorMatchingInlineSnapshot()`](https://jestjs.io/docs/expect#tothrowerrormatchinginlinesnapshotinlinesnapshot)
|
|
546
546
|
|
|
547
547
|
{% /table %}
|
package/package.json
CHANGED
package/test.d.ts
CHANGED
|
@@ -1358,6 +1358,57 @@ declare module "bun:test" {
|
|
|
1358
1358
|
* @param hint Hint used to identify the snapshot in the snapshot file.
|
|
1359
1359
|
*/
|
|
1360
1360
|
toMatchSnapshot(propertyMatchers?: object, hint?: string): void;
|
|
1361
|
+
/**
|
|
1362
|
+
* Asserts that a value matches the most recent inline snapshot.
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* expect("Hello").toMatchInlineSnapshot();
|
|
1366
|
+
* expect("Hello").toMatchInlineSnapshot(`"Hello"`);
|
|
1367
|
+
*
|
|
1368
|
+
* @param value The latest automatically-updated snapshot value.
|
|
1369
|
+
*/
|
|
1370
|
+
toMatchInlineSnapshot(value?: string): void;
|
|
1371
|
+
/**
|
|
1372
|
+
* Asserts that a value matches the most recent inline snapshot.
|
|
1373
|
+
*
|
|
1374
|
+
* @example
|
|
1375
|
+
* expect({ c: new Date() }).toMatchInlineSnapshot({ c: expect.any(Date) });
|
|
1376
|
+
* expect({ c: new Date() }).toMatchInlineSnapshot({ c: expect.any(Date) }, `
|
|
1377
|
+
* {
|
|
1378
|
+
* "v": Any<Date>,
|
|
1379
|
+
* }
|
|
1380
|
+
* `);
|
|
1381
|
+
*
|
|
1382
|
+
* @param propertyMatchers Object containing properties to match against the value.
|
|
1383
|
+
* @param value The latest automatically-updated snapshot value.
|
|
1384
|
+
*/
|
|
1385
|
+
toMatchInlineSnapshot(propertyMatchers?: object, value?: string): void;
|
|
1386
|
+
/**
|
|
1387
|
+
* Asserts that a function throws an error matching the most recent snapshot.
|
|
1388
|
+
*
|
|
1389
|
+
* @example
|
|
1390
|
+
* function fail() {
|
|
1391
|
+
* throw new Error("Oops!");
|
|
1392
|
+
* }
|
|
1393
|
+
* expect(fail).toThrowErrorMatchingSnapshot();
|
|
1394
|
+
* expect(fail).toThrowErrorMatchingSnapshot("This one should say Oops!");
|
|
1395
|
+
*
|
|
1396
|
+
* @param value The latest automatically-updated snapshot value.
|
|
1397
|
+
*/
|
|
1398
|
+
toThrowErrorMatchingSnapshot(hint?: string): void;
|
|
1399
|
+
/**
|
|
1400
|
+
* Asserts that a function throws an error matching the most recent snapshot.
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* function fail() {
|
|
1404
|
+
* throw new Error("Oops!");
|
|
1405
|
+
* }
|
|
1406
|
+
* expect(fail).toThrowErrorMatchingInlineSnapshot();
|
|
1407
|
+
* expect(fail).toThrowErrorMatchingInlineSnapshot(`"Oops!"`);
|
|
1408
|
+
*
|
|
1409
|
+
* @param value The latest automatically-updated snapshot value.
|
|
1410
|
+
*/
|
|
1411
|
+
toThrowErrorMatchingInlineSnapshot(value?: string): void;
|
|
1361
1412
|
/**
|
|
1362
1413
|
* Asserts that an object matches a subset of properties.
|
|
1363
1414
|
*
|