Skip to content

Commit

Permalink
Fix isFunction failure message differences
Browse files Browse the repository at this point in the history
The toString representation of functions has changed slightly between
Node 8 and Node 10. Node 10 retains the original whitespace between
the function keyword and the opening braces while Node 8 always inserts
a blank.
  • Loading branch information
mantoni authored and mroderick committed Aug 7, 2018
1 parent b98bcb4 commit f463241
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/assertions/is-function.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module.exports = function(referee) {
expectation: "toBeFunction",
values: function(actual, message) {
return {
actual: String(actual).replace("\n", ""),
actual: String(actual)
.replace("function(", "function (")
.replace("\n", ""),
actualType: typeof actual,
customMessage: message
};
Expand Down

0 comments on commit f463241

Please sign in to comment.