From aeab64e9de9a99cd16a48cfa537202ee1f7a7795 Mon Sep 17 00:00:00 2001 From: weidehai <243395655@qq.com> Date: Sat, 8 Oct 2022 00:14:04 +0800 Subject: [PATCH] chore: fix InlineSnapshots test file type error (#13402) --- .../jest-snapshot/src/__tests__/InlineSnapshots.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts index 0d924fda83e7..cef97e0dc40e 100644 --- a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts +++ b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts @@ -15,7 +15,7 @@ import {saveInlineSnapshots} from '../InlineSnapshots'; jest.mock('prettier', () => { const realPrettier = jest.requireActual('prettier'); - const mockPrettier: typeof import('prettier') = { + const mockPrettier = { format: (text, opts) => realPrettier.format(text, { pluginSearchDirs: [ @@ -23,10 +23,10 @@ jest.mock('prettier', () => { ], ...opts, }), - getFileInfo: {sync: () => ({ignored: false, inferredParser: 'babel'})}, - resolveConfig: {sync: jest.fn()}, + getFileInfo: {sync: () => ({ignored: false, inferredParser: 'babel'})} as unknown as typeof prettier.getFileInfo, + resolveConfig: {sync: jest.fn()} as unknown as typeof prettier.resolveConfig, version: realPrettier.version, - }; + } as typeof prettier; return mockPrettier; });