From 198fe2ee212b0baf1cf32d2b49eb6892ee1ecd77 Mon Sep 17 00:00:00 2001 From: Art Date: Mon, 10 Apr 2023 10:57:13 +0700 Subject: [PATCH] fixes code style --- CHANGELOG.md | 2 +- packages/jest-snapshot/src/index.ts | 2 +- packages/jest-snapshot/src/types.ts | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92876f62c0cb..6c9e1440a587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/jest-snapshot/src/index.ts b/packages/jest-snapshot/src/index.ts index 08932443ad5f..18758df28dc7 100644 --- a/packages/jest-snapshot/src/index.ts +++ b/packages/jest-snapshot/src/index.ts @@ -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; diff --git a/packages/jest-snapshot/src/types.ts b/packages/jest-snapshot/src/types.ts index 69ccae322464..f6218ae888c5 100644 --- a/packages/jest-snapshot/src/types.ts +++ b/packages/jest-snapshot/src/types.ts @@ -57,18 +57,16 @@ export interface SnapshotMatchers, 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>( propertyMatchers: Partial, 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. @@ -93,12 +91,11 @@ export interface SnapshotMatchers, 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;