From 8a3c1134bcc410c17e885947cc799df68e16ae6b Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Sun, 16 Jul 2017 15:18:05 +0800 Subject: [PATCH] test: use regexp to confir error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In test/parallel/test-stream-writable-null.js, use a regular expression to validate error message in assert.throws() call. PR-URL: https://github.com/nodejs/node/pull/14268 Reviewed-By: Rich Trott Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu Reviewed-By: Tobias Nießen Reviewed-By: Gireesh Punathil Reviewed-By: Refael Ackermann --- test/parallel/test-stream-writable-null.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-stream-writable-null.js b/test/parallel/test-stream-writable-null.js index 50ed1d286a48a3..0bb8aa7bbc1c10 100644 --- a/test/parallel/test-stream-writable-null.js +++ b/test/parallel/test-stream-writable-null.js @@ -32,7 +32,7 @@ assert.doesNotThrow(() => { assert.throws(() => { const m = new MyWritable(); m.write(false, (err) => assert.ok(err)); -}, TypeError, 'Invalid non-string/buffer chunk'); +}, /^TypeError: Invalid non-string\/buffer chunk$/); assert.doesNotThrow(() => { const m = new MyWritable().on('error', (e) => { assert.ok(e);