Skip to content

Commit

Permalink
ternary
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 28, 2019
1 parent 47fc113 commit 32e59a8
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/jest-circus/src/utils.ts
Expand Up @@ -175,15 +175,9 @@ export const callAsyncCircusFn = (
// soon as `done` called.
if (fn.length) {
const done = (reason?: Error | string): void => {
let errorAsErrorObject: Error;

if (checkIsError(reason)) {
errorAsErrorObject = reason;
} else {
errorAsErrorObject = new Error(
`Failed: ${prettyFormat(reason, {maxDepth: 3})}`,
);
}
const errorAsErrorObject = checkIsError(reason)
? reason
: new Error(`Failed: ${prettyFormat(reason, {maxDepth: 3})}`);

// Consider always throwing, regardless if `reason` is set or not
if (completed && reason) {
Expand Down

0 comments on commit 32e59a8

Please sign in to comment.