From f463241de0330a16d6943153c9a622031e2cb32a Mon Sep 17 00:00:00 2001 From: Maximilian Antoni Date: Tue, 7 Aug 2018 14:16:58 +0200 Subject: [PATCH] Fix isFunction failure message differences 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. --- lib/assertions/is-function.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/assertions/is-function.js b/lib/assertions/is-function.js index 0d613e2d..fe3a82a9 100644 --- a/lib/assertions/is-function.js +++ b/lib/assertions/is-function.js @@ -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 };