From 7bafa216d6af8cd8807b89c79faddf1eea961c36 Mon Sep 17 00:00:00 2001 From: liuxingbaoyu <30521560+liuxingbaoyu@users.noreply.github.com> Date: Fri, 12 Aug 2022 15:03:52 +0800 Subject: [PATCH] fix --- .../jest-snapshot/src/__tests__/InlineSnapshots.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts index 304b098301c4..a1c275177865 100644 --- a/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts +++ b/packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts @@ -30,16 +30,20 @@ jest.mock('prettier', () => { return mockPrettier; }); -let dir: string; beforeEach(() => { jest.mocked(prettier.resolveConfig.sync).mockReset(); }); +let dir: string; beforeEach(() => { dir = path.join(tmpdir(), `jest-inline-snapshot-test-${Date.now()}`); fs.mkdirSync(dir); }); +afterEach(() => { + fs.rmSync(dir, {recursive: true}); +}); + test('saveInlineSnapshots() replaces empty function call with a template literal', () => { const filename = path.join(dir, 'my.test.js'); fs.writeFileSync(filename, 'expect(1).toMatchInlineSnapshot();\n');