From f8b69e21012efa932829505571408017f2e77d42 Mon Sep 17 00:00:00 2001 From: legalcodes Date: Fri, 20 Jan 2017 00:57:41 -0800 Subject: [PATCH 1/2] test: check error msg in test/parallel/test-fs-make-callback.js --- test/parallel/test-fs-make-callback.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js index 6e4572ee352197..ecef9457bc2e2e 100644 --- a/test/parallel/test-fs-make-callback.js +++ b/test/parallel/test-fs-make-callback.js @@ -2,6 +2,8 @@ const common = require('../common'); const assert = require('assert'); const fs = require('fs'); +const cbTypeError = /^TypeError: "callback" argument must be a function$/; + function test(cb) { return function() { @@ -26,13 +28,13 @@ process.once('warning', common.mustCall((warning) => { assert.doesNotThrow(test()); function invalidArgumentsTests() { - assert.throws(test(null)); - assert.throws(test(true)); - assert.throws(test(false)); - assert.throws(test(1)); - assert.throws(test(0)); - assert.throws(test('foo')); - assert.throws(test(/foo/)); - assert.throws(test([])); - assert.throws(test({})); + assert.throws(test(null), cbTypeError); + assert.throws(test(true), cbTypeError); + assert.throws(test(false), cbTypeError); + assert.throws(test(1), cbTypeError); + assert.throws(test(0), cbTypeError); + assert.throws(test('foo'), cbTypeError); + assert.throws(test(/foo/), cbTypeError); + assert.throws(test([]), cbTypeError); + assert.throws(test({}), cbTypeError); } From 49877754573dbc7ba5e6390bb429ea744cb6af95 Mon Sep 17 00:00:00 2001 From: legalcodes Date: Sat, 21 Jan 2017 09:40:56 -0800 Subject: [PATCH 2/2] Removed extra line --- test/parallel/test-fs-make-callback.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js index ecef9457bc2e2e..40c9aa42995f9a 100644 --- a/test/parallel/test-fs-make-callback.js +++ b/test/parallel/test-fs-make-callback.js @@ -4,7 +4,6 @@ const assert = require('assert'); const fs = require('fs'); const cbTypeError = /^TypeError: "callback" argument must be a function$/; - function test(cb) { return function() { // fs.stat() calls makeCallback() on its second argument