Skip to content

Commit

Permalink
fix: an unstable test (#13120)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu authored Aug 12, 2022
1 parent f9718de commit efd17b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/jest-snapshot/src/__tests__/InlineSnapshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit efd17b9

Please sign in to comment.