Skip to content
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
Next Next commit
Replace conditional ands with default and destructuring
  • Loading branch information
pedrottimark committed Feb 2, 2018
commit cc7a8a5ff82d9926b77da63ffaf7d4d290b3e7eb
10 changes: 4 additions & 6 deletions packages/jest-matcher-utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,13 @@ export const matcherHint = (
matcherName: string,
received: string = 'received',
expected: string = 'expected',
options: ?{
options: {
comment?: string,
isDirectExpectCall?: boolean,
secondArgument?: ?string,
},
} = {},
) => {
const comment = options && options.comment ? ` // ${options.comment}` : '';
const isDirectExpectCall = options && options.isDirectExpectCall;
const secondArgument = options && options.secondArgument;
const {comment, isDirectExpectCall, secondArgument} = options;
return (
chalk.dim('expect' + (isDirectExpectCall ? '' : '(')) +
RECEIVED_COLOR(received) +
Expand All @@ -167,6 +165,6 @@ export const matcherHint = (
(secondArgument
? `${chalk.dim(', ')}${EXPECTED_COLOR(secondArgument)}`
: '') +
chalk.dim(`)${comment}`)
chalk.dim(`)${comment ? ` // ${comment}` : ''}`)
);
};