Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be3e82d

Browse filesBrowse files
legalcodesItalo A. Casas
authored andcommitted
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>
1 parent 67d97bc commit be3e82d
Copy full SHA for be3e82d

File tree

Expand file treeCollapse file tree

1 file changed

+10
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-9
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-make-callback.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-make-callback.js
+10-9Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const common = require('../common');
33
const assert = require('assert');
44
const fs = require('fs');
5+
const cbTypeError = /^TypeError: "callback" argument must be a function$/;
56

67
function test(cb) {
78
return function() {
@@ -26,13 +27,13 @@ process.once('warning', common.mustCall((warning) => {
2627
assert.doesNotThrow(test());
2728

2829
function invalidArgumentsTests() {
29-
assert.throws(test(null));
30-
assert.throws(test(true));
31-
assert.throws(test(false));
32-
assert.throws(test(1));
33-
assert.throws(test(0));
34-
assert.throws(test('foo'));
35-
assert.throws(test(/foo/));
36-
assert.throws(test([]));
37-
assert.throws(test({}));
30+
assert.throws(test(null), cbTypeError);
31+
assert.throws(test(true), cbTypeError);
32+
assert.throws(test(false), cbTypeError);
33+
assert.throws(test(1), cbTypeError);
34+
assert.throws(test(0), cbTypeError);
35+
assert.throws(test('foo'), cbTypeError);
36+
assert.throws(test(/foo/), cbTypeError);
37+
assert.throws(test([]), cbTypeError);
38+
assert.throws(test({}), cbTypeError);
3839
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.