Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: refactor to const/let and assert.strictEqual #9965

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions test/parallel/test-fs-read-stream-err.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var fs = require('fs');
const common = require('../common');
const assert = require('assert');
const fs = require('fs');

var stream = fs.createReadStream(__filename, {
const stream = fs.createReadStream(__filename, {
bufferSize: 64
});
var err = new Error('BAM');
const err = new Error('BAM');

stream.on('error', common.mustCall(function errorHandler(err_) {
console.error('error event');
process.nextTick(function() {
assert.equal(stream.fd, null);
assert.equal(err_, err);
assert.strictEqual(stream.fd, null);
assert.strictEqual(err_, err);
});
}));

fs.close = common.mustCall(function(fd_, cb) {
assert.equal(fd_, stream.fd);
assert.strictEqual(fd_, stream.fd);
process.nextTick(cb);
});

var read = fs.read;
const read = fs.read;
fs.read = function() {
// first time is ok.
read.apply(fs, arguments);
// then it breaks
fs.read = function() {
var cb = arguments[arguments.length - 1];
const cb = arguments[arguments.length - 1];
process.nextTick(function() {
cb(err);
});
Expand Down