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 4bbd50e

Browse filesBrowse files
edsadrMylesBorins
authored andcommitted
test: improve code in test-fs-readfile-error
* use const instead of var * use common.mustCall to control the functions execution automatically * use assert.strictEqual instead of assert.equal * use assert.notStrictEqual instead of assert.notEqual * use arrow functions PR-URL: #10367 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 9840f50 commit 4bbd50e
Copy full SHA for 4bbd50e

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+15
-15
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-readfile-error.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-readfile-error.js
+15-15Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var exec = require('child_process').exec;
5-
var path = require('path');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const exec = require('child_process').exec;
5+
const path = require('path');
66

77
// `fs.readFile('/')` does not fail on FreeBSD, because you can open and read
88
// the directory there.
@@ -14,28 +14,28 @@ if (process.platform === 'freebsd') {
1414
var callbacks = 0;
1515

1616
function test(env, cb) {
17-
var filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
18-
var execPath = '"' + process.execPath + '" "' + filename + '"';
19-
var options = { env: Object.assign(process.env, env) };
20-
exec(execPath, options, function(err, stdout, stderr) {
17+
const filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
18+
const execPath = '"' + process.execPath + '" "' + filename + '"';
19+
const options = { env: Object.assign(process.env, env) };
20+
exec(execPath, options, common.mustCall((err, stdout, stderr) => {
2121
assert(err);
22-
assert.equal(stdout, '');
23-
assert.notEqual(stderr, '');
22+
assert.strictEqual(stdout, '');
23+
assert.notStrictEqual(stderr, '');
2424
cb('' + stderr);
25-
});
25+
}));
2626
}
2727

28-
test({ NODE_DEBUG: '' }, function(data) {
28+
test({ NODE_DEBUG: '' }, common.mustCall((data) => {
2929
assert(/EISDIR/.test(data));
3030
assert(!/test-fs-readfile-error/.test(data));
3131
callbacks++;
32-
});
32+
}));
3333

34-
test({ NODE_DEBUG: 'fs' }, function(data) {
34+
test({ NODE_DEBUG: 'fs' }, common.mustCall((data) => {
3535
assert(/EISDIR/.test(data));
3636
assert(/test-fs-readfile-error/.test(data));
3737
callbacks++;
38-
});
38+
}));
3939

4040
process.on('exit', function() {
4141
assert.equal(callbacks, 2);

0 commit comments

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