[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inline snapshot indenting #9523

Merged
merged 5 commits into from
Feb 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove extra dedent
  • Loading branch information
SimenB committed Feb 6, 2020
commit cecda64e344c3ab24d1ae98c18e53ddb783a1243
7 changes: 3 additions & 4 deletions e2e/__tests__/toMatchInlineSnapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ import * as path from 'path';
import {wrap} from 'jest-snapshot-serializer-raw';
import {cleanup, makeTemplate, writeFiles} from '../Utils';
import runJest from '../runJest';
import dedent = require('dedent');

const DIR = path.resolve(__dirname, '../to-match-inline-snapshot');
const TESTS_DIR = path.resolve(DIR, '__tests__');

const readFile = filename =>
const readFile = (filename: string) =>
fs.readFileSync(path.join(TESTS_DIR, filename), 'utf8');

beforeEach(() => cleanup(TESTS_DIR));
Expand Down Expand Up @@ -364,7 +363,7 @@ test('multiple custom matchers and native matchers', () => {

test('indentation is correct in the presences of existing snapshots', () => {
const filename = 'existing-snapshot.test.js';
const test = dedent(`
const test = `
SimenB marked this conversation as resolved.
Show resolved Hide resolved
test('existing snapshot', () => {
expect({ hello: 'world' }).toMatchInlineSnapshot(\`
Object {
Expand All @@ -373,7 +372,7 @@ test('indentation is correct in the presences of existing snapshots', () => {
\`);
expect({ hello: 'world' }).toMatchInlineSnapshot();
});
`);
`;

writeFiles(TESTS_DIR, {[filename]: test});
const {stderr, exitCode} = runJest(DIR, ['-w=1', '--ci=false', filename]);
Expand Down