Permalink
Browse files

test: check error message in test-fs-make-callback

Add a RegExp to `throws` assertions.

PR-URL: #10914
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
legalcodes authored and targos committed Jan 20, 2017
1 parent 087516a commit 5614dc30ddf8a82163382bb864c0cbc608714d85
Showing with 10 additions and 9 deletions.
  1. +10 −9 test/parallel/test-fs-make-callback.js
@@ -2,6 +2,7 @@
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 +27,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);
}

0 comments on commit 5614dc3

Please sign in to comment.