Skip to content

Commit

Permalink
Jest 21 expects result.message to always be a function
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelzor committed Aug 25, 2017
1 parent 47eaa98 commit d5f18db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/jest-enzyme/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ beforeEach(() => {
[matcherKey](wrapper, ...args) {
const result = enzymeMatchers[matcherKey].call(this, wrapper, ...args);

if (this.isNot) {
result.message = result.negatedMessage;
}
let message = this.isNot ? result.negatedMessage : result.message;

if (result.contextualInformation.expected) {
result.message += `\n${this.utils.RECEIVED_COLOR(
message += `\n${this.utils.RECEIVED_COLOR(
result.contextualInformation.expected
)}`;
}

if (result.contextualInformation.actual) {
result.message += `\n${this.utils.EXPECTED_COLOR(
message += `\n${this.utils.EXPECTED_COLOR(
result.contextualInformation.actual
)}`;
}

result.message = () => message;

return result;
},
}[matcherKey];
Expand Down

0 comments on commit d5f18db

Please sign in to comment.