From d19295bad7094b4a166f1796d20abf88c32deb36 Mon Sep 17 00:00:00 2001 From: Sam Shull Date: Thu, 1 Dec 2016 09:49:28 -0800 Subject: [PATCH 1/2] test: Add regex check to error expectation Creating a buffer from a number should throw an error with a message that describes the issue. --- test/parallel/test-buffer-bad-overload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-bad-overload.js b/test/parallel/test-buffer-bad-overload.js index 3d99dd532e9b93..7b41991aa6256e 100644 --- a/test/parallel/test-buffer-bad-overload.js +++ b/test/parallel/test-buffer-bad-overload.js @@ -8,7 +8,7 @@ assert.doesNotThrow(function() { assert.throws(function() { Buffer.from(10, 'hex'); -}); +}, /argument must not be a number/); assert.doesNotThrow(function() { Buffer.from('deadbeaf', 'hex'); From 70f5564b8333682025abcbb3edf693de59f97356 Mon Sep 17 00:00:00 2001 From: Sam Shull Date: Fri, 16 Dec 2016 10:12:37 -0800 Subject: [PATCH 2/2] Match full error message --- test/parallel/test-buffer-bad-overload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-bad-overload.js b/test/parallel/test-buffer-bad-overload.js index 7b41991aa6256e..d5626e16d14419 100644 --- a/test/parallel/test-buffer-bad-overload.js +++ b/test/parallel/test-buffer-bad-overload.js @@ -8,7 +8,7 @@ assert.doesNotThrow(function() { assert.throws(function() { Buffer.from(10, 'hex'); -}, /argument must not be a number/); +}, /^TypeError: "value" argument must not be a number$/); assert.doesNotThrow(function() { Buffer.from('deadbeaf', 'hex');