Skip to content

Commit

Permalink
fixes code style
Browse files Browse the repository at this point in the history
  • Loading branch information
bakamitai456 committed Jun 15, 2023
1 parent c6ca50e commit 198fe2e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- `[jest-cli]` Include type definitions to generated config files ([#14078](https://github.com/facebook/jest/pull/14078))
- `[jest-snapshot]` Support arrays as property matchers ([#14025](https://github.com/facebook/jest/pull/14025))
- `[jest-snapshot]` Add `toMatchNamedSnapshot` to bring snapshot support to concurrent mode
- `[jest-snapshot]` Add `toMatchNamedSnapshot` to bring snapshot support to concurrent mode ([#14045](https://github.com/facebook/jest/pull/14045))

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-snapshot/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export const toMatchSnapshot: MatcherFunctionWithContext<

export const toMatchNamedSnapshot: MatcherFunctionWithContext<
Context,
[propertiesOrSnapshot?: object | string, snapshotName?: string]
[propertiesOrSnapshotName?: object | string, snapshotName?: string]
> = function (received, propertiesOrSnapshotName, snapshotName) {
const matcherName = 'toMatchNamedSnapshot';
let properties;
Expand Down
15 changes: 6 additions & 9 deletions packages/jest-snapshot/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@ export interface SnapshotMatchers<R extends void | Promise<void>, T> {
/**
* This ensures that a value matches the specific snapshot.
* Instead of use current test name in global state, it will use the specific name to find the snapshot.
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
*/
toMatchNamedSnapshot(snapshotName?: string): R;
/**
* This ensures that a value matches the specific snapshot with property matchers.
* Instead of use current test name in global state, it will use the specific name to find the snapshot.
*/
toMatchNamedSnapshot<U extends Record<keyof T, unknown>>(
propertyMatchers: Partial<U>,
snapshot?: string,
): R;
/**
* This ensures that a value matches the specific snapshot.
* Instead of use current test name in global state, it will use the specific name to find the snapshot.
* Check out [the Snapshot Testing guide](https://jestjs.io/docs/snapshot-testing) for more information.
*/
toMatchNamedSnapshot(snapshotName?: 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.
Expand All @@ -93,12 +91,11 @@ export interface SnapshotMatchers<R extends void | Promise<void>, T> {
* Instead of writing the snapshot value to a .snap file, it will be written into the source code automatically.
*/
toThrowErrorMatchingInlineSnapshot(snapshot?: string): R;

/**
* Used to test that a function throws a error matching the specific snapshot.
* Instead of use current test name in global state, it will use the specific name to find the snapshot.
*/
toThrowErrorMatchingNamedSnapshot(name?: string): R;
toThrowErrorMatchingNamedSnapshot(snapshotName?: string): R;
}

export type SnapshotFormat = Omit<PrettyFormatOptions, 'compareKeys'>;

0 comments on commit 198fe2e

Please sign in to comment.