Skip to content

Commit 2c33819

Browse files
cjihrigsilverwind
authored andcommitted
test: fix tests that check error messages
20285ad changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes. PR-URL: #3727 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Johan Bergström <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 7b89a3d commit 2c33819

27 files changed

+63
-63
lines changed

lib/path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ posix.extname = function(path) {
566566
posix.format = function(pathObject) {
567567
if (pathObject === null || typeof pathObject !== 'object') {
568568
throw new TypeError(
569-
"Parameter 'pathObject' must be an object, not " + typeof pathObject
569+
'Parameter "pathObject" must be an object, not ' + typeof pathObject
570570
);
571571
}
572572

test/parallel/test-assert.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ function testBlockTypeError(method, block) {
438438
method(block);
439439
threw = false;
440440
} catch (e) {
441-
assert.equal(e.toString(), 'TypeError: block must be a function');
441+
assert.equal(e.toString(),
442+
'TypeError: "block" argument must be a function');
442443
}
443444

444445
assert.ok(threw);

test/parallel/test-buffer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,11 +1222,11 @@ assert.throws(function() {
12221222

12231223
assert.throws(function() {
12241224
new Buffer();
1225-
}, /must start with number, buffer, array or string/);
1225+
}, /Must start with number, buffer, array or string/);
12261226

12271227
assert.throws(function() {
12281228
new Buffer(null);
1229-
}, /must start with number, buffer, array or string/);
1229+
}, /Must start with number, buffer, array or string/);
12301230

12311231

12321232
// Test prototype getters don't throw

test/parallel/test-child-process-spawn-typeerror.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const common = require('../common');
88
const cmd = common.isWindows ? 'rundll32' : 'ls';
99
const invalidcmd = 'hopefully_you_dont_have_this_on_your_machine';
1010
const invalidArgsMsg = /Incorrect value of args option/;
11-
const invalidOptionsMsg = /options argument must be an object/;
11+
const invalidOptionsMsg = /"options" argument must be an object/;
1212
const empty = common.fixturesDir + '/empty.js';
1313

1414
assert.throws(function() {

test/parallel/test-file-write-stream3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function run_test_4() {
178178
function() {
179179
file = fs.createWriteStream(filepath, options);
180180
},
181-
/start must be/
181+
/"start" must be/
182182
);
183183

184184
}

test/parallel/test-fs-access.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ assert.throws(function() {
9696

9797
assert.throws(function() {
9898
fs.access(__filename, fs.F_OK);
99-
}, /callback must be a function/);
99+
}, /"callback" argument must be a function/);
100100

101101
assert.throws(function() {
102102
fs.access(__filename, fs.F_OK, {});
103-
}, /callback must be a function/);
103+
}, /"callback" argument must be a function/);
104104

105105
assert.doesNotThrow(function() {
106106
fs.accessSync(__filename);

test/parallel/test-fs-null-bytes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var assert = require('assert');
44
var fs = require('fs');
55

66
function check(async, sync) {
7-
var expected = /Path must be a string without null bytes./;
7+
var expected = /Path must be a string without null bytes/;
88
var argsSync = Array.prototype.slice.call(arguments, 2);
99
var argsAsync = argsSync.concat(function(er) {
1010
assert(er && er.message.match(expected));

test/parallel/test-fs-read-buffer-tostring-fail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ stream.on('finish', common.mustCall(function() {
2929
fd = fs.openSync(file, 'r');
3030
fs.read(fd, kStringMaxLength + 1, 0, 'utf8', common.mustCall(function(err) {
3131
assert.ok(err instanceof Error);
32-
assert.strictEqual('toString failed', err.message);
32+
assert.strictEqual('"toString()" failed', err.message);
3333
}));
3434
}));
3535

test/parallel/test-fs-read-stream-inherit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ file6.on('end', function() {
114114

115115
assert.throws(function() {
116116
fs.createReadStream(rangeFile, Object.create({start: 10, end: 2}));
117-
}, /start must be <= end/);
117+
}, /"start" option must be <= "end" option/);
118118

119119
var stream = fs.createReadStream(rangeFile, Object.create({ start: 0,
120120
end: 0 }));

test/parallel/test-fs-read-stream-throw-type-error.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ assert.doesNotThrow(function() {
1818

1919
assert.throws(function() {
2020
fs.createReadStream(example, null);
21-
}, /options must be a string or an object/);
21+
}, /"options" argument must be a string or an object/);
2222
assert.throws(function() {
2323
fs.createReadStream(example, 123);
24-
}, /options must be a string or an object/);
24+
}, /"options" argument must be a string or an object/);
2525
assert.throws(function() {
2626
fs.createReadStream(example, 0);
27-
}, /options must be a string or an object/);
27+
}, /"options" argument must be a string or an object/);
2828
assert.throws(function() {
2929
fs.createReadStream(example, true);
30-
}, /options must be a string or an object/);
30+
}, /"options" argument must be a string or an object/);
3131
assert.throws(function() {
3232
fs.createReadStream(example, false);
33-
}, /options must be a string or an object/);
33+
}, /"options" argument must be a string or an object/);

0 commit comments

Comments
 (0)