mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
@types/jest: relax type definition for toMatchSnapshot (#29371)
This commit is contained in:
4
types/jest/index.d.ts
vendored
4
types/jest/index.d.ts
vendored
@@ -665,7 +665,7 @@ declare namespace jest {
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
|
||||
*/
|
||||
toMatchSnapshot<T extends {[P in keyof R]: Expect['any']}>(propertyMatchers: Partial<T>, snapshotName?: string): R;
|
||||
toMatchSnapshot<T extends {[P in keyof R]: any}>(propertyMatchers: Partial<T>, snapshotName?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot.
|
||||
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
|
||||
@@ -676,7 +676,7 @@ declare namespace jest {
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
|
||||
*/
|
||||
toMatchInlineSnapshot<T extends {[P in keyof R]: Expect['any']}>(propertyMatchers: Partial<T>, snapshot?: string): R;
|
||||
toMatchInlineSnapshot<T extends {[P in keyof R]: any}>(propertyMatchers: Partial<T>, snapshot?: string): R;
|
||||
/**
|
||||
* This ensures that a value matches the most recent snapshot with property matchers.
|
||||
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
|
||||
|
||||
@@ -628,8 +628,16 @@ describe("", () => {
|
||||
expect({
|
||||
one: 1,
|
||||
two: "2",
|
||||
three: 3,
|
||||
four: { four: 3 },
|
||||
date: new Date(),
|
||||
}).toMatchSnapshot({ one: expect.any(Number), date: expect.any(Date) });
|
||||
}).toMatchSnapshot({
|
||||
one: expect.any(Number),
|
||||
// Leave 'two' to the auto-generated snapshot
|
||||
three: 3,
|
||||
four: { four: expect.any(Number) },
|
||||
date: expect.any(Date),
|
||||
});
|
||||
|
||||
expect({}).toMatchInlineSnapshot();
|
||||
expect({}).toMatchInlineSnapshot("snapshot");
|
||||
@@ -637,8 +645,16 @@ describe("", () => {
|
||||
expect({
|
||||
one: 1,
|
||||
two: "2",
|
||||
three: 3,
|
||||
four: { four: 3 },
|
||||
date: new Date(),
|
||||
}).toMatchInlineSnapshot({ one: expect.any(Number), date: expect.any(Date) });
|
||||
}).toMatchInlineSnapshot({
|
||||
one: expect.any(Number),
|
||||
// leave out two
|
||||
three: 3,
|
||||
four: { four: expect.any(Number) },
|
||||
date: expect.any(Date),
|
||||
});
|
||||
|
||||
expect(jest.fn()).toReturn();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user