Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
2a9e9d4
tools: use no-use-before-define ESLint rule
vsemozhetbyt Jul 1, 2017
7b53be0
test: fix flaky test-https-set-timeout-server
Trott Jul 8, 2017
d35e5c7
test: fix flaky http(s)-set-server-timeout tests
Trott Jul 20, 2017
194836f
v8: handle proxy objects in MakeMirror(), v1
bnoordhuis Jul 24, 2017
5a93c16
v8: handle proxy objects in MakeMirror(), v2
bnoordhuis Jul 24, 2017
ae3e7be
v8: fix RegExp nits in v8_prof_polyfill.js
vsemozhetbyt Jun 15, 2017
c96e938
tools: update to ESLint 4.1.0
Trott Jun 24, 2017
58e0c5c
tools: add script to update ESLint
Trott Jun 24, 2017
05ee559
tools: update to ESLint 4.1.1
Trott Jun 27, 2017
175d46e
test: skip test-fs-readdir-ucs2 if no support
Trott Jul 1, 2017
9320db0
tools: remove align-multiline-assignment lint rule
Trott Jul 5, 2017
e8c0e0f
lib: use consistent indentation for ternaries
Trott Jul 5, 2017
5e6c711
lib: remove excess indentation
Trott Jul 5, 2017
a75ba80
lib: normalize indentation in parentheses
Trott Jul 7, 2017
5ef17b7
lib: update indentation of ternaries
Trott Jul 15, 2017
b0f8bc9
test: adjust indentation for stricter linting
Trott Jul 25, 2017
5f7827d
doc: fix indentation issues in sample code
Trott Jun 27, 2017
f46e14c
tools: remove legacy indentation linting
Trott Aug 15, 2017
e0f8b18
src: remove GTEST_DONT_DEFINE_ASSERT_EQ in util.h
danbev Apr 25, 2017
44d3047
test: simplify test skipping
vsemozhetbyt Jun 30, 2017
162bc81
build,windows: implement PEP514 python detection
refack Jun 24, 2017
970fe59
build,windows: restore DISTTYPEDIR
refack Jun 28, 2017
1b9563a
build,win: fix python detection script
jasongin Jul 31, 2017
124d5e1
tools: generate template literal for addon tests
Trott Jul 5, 2017
f868b75
doc,test: fs - reserved characters under win32
XadillaX Jul 4, 2017
7a1ff59
doc: fix mistake in http.md
galeo Jul 7, 2017
6624a02
doc: note 'resize' event conditions on Windows
Dean-Coakley Jun 9, 2017
584f0f4
doc: correct stream Duplex allowHalfOpen doc
Trott Jul 7, 2017
5c3fd35
test: add get/set effective uid/gid tests
evanlucas Jul 5, 2017
3bd0c7c
test: remove common.noop
Trott May 4, 2017
ec68f07
tools: update ESLint to 4.2.0
Trott Aug 16, 2017
f395b48
tools: update package.json `engine` field
strugee Jul 12, 2017
98466c5
doc: update umask for clarity
jsumners Jul 11, 2017
b646c2a
benchmark: fix typo in inspect-proxy
vsemozhetbyt Jul 14, 2017
b89e806
test: fix flaky test-net-can-reset-timeout
Trott Jul 15, 2017
ed6d4f0
test: check complete error message
fraserxu Jul 16, 2017
b64fe2e
test: use regular expression to match error msg
Amunu Jul 16, 2017
a71e23a
test: use regluar expression in vm test
AkiraXue Jul 16, 2017
49312cb
test: use regexp to confir error message
bangwu Jul 16, 2017
d462267
test: simplify string concatenation
jiangplus Jul 16, 2017
a4281c6
test: use template literal for string concat
whatwewant Jul 16, 2017
f84a7a6
test: use regex error checks in test-util-format
superwoods Jul 16, 2017
41e4e46
doc: move LTS README link to increase prominence
gibfahn Jul 16, 2017
5303db7
http: OutgoingMessage change writable after end
Kasher Jun 30, 2017
01d7d30
gyp: implement LD/LDXX for ninja and FIPS
sam-github Jul 13, 2017
2039435
test: check error with regex in test-signal-safety
shaman2009 Jul 16, 2017
3148bc7
test: use regex error check in test-crypto-random
f48vj Jul 16, 2017
1e10f9f
test: fix error handling test-http-full-response
Trott Jul 15, 2017
3be54c8
test: replace concatenation with template literals
csvwolf Jul 16, 2017
1a8bf8a
doc,stream: _transform happens one at a time
mcollina Jul 17, 2017
1703871
doc: replace dead link in v8 module
drboyer Jul 19, 2017
028f650
docs: add note about fs.rmdir()
Oleksandr-Kushchak-i2 Jul 17, 2017
49662f3
build,tools: do not force codesign prefix
evanlucas Jul 12, 2017
1209832
build: codesign tarball binary on macOS
evanlucas Jul 12, 2017
bc1d4c5
test: use path.join for long path concatenation
jankjn Jul 16, 2017
b21a42d
doc: add XadillaX to collaborators
XadillaX Jul 20, 2017
9aa4a5b
test: replace string concatenation with template
Jul 16, 2017
6e08ae0
test: replace concatenation with template literals
leizongmin Jul 16, 2017
c3bb07c
doc: describe labelling process for backports
addaleax Apr 15, 2017
6e65501
deps: cherry-pick 18ea996 from c-ares upstream
addaleax Jul 15, 2017
ad86c26
doc: update experimental status to reflect use
jasnell Apr 28, 2017
fd5d6c9
test: replace concatenation with template literal
HSUCHING Jul 16, 2017
cdcec0c
test: replace concatenation with template literal
rockcoder23 Jul 16, 2017
b9a5253
test: fix flaky test-force-repl
Trott Jul 23, 2017
baa11a1
test: improve error logging for inspector test
Trott Jul 27, 2017
7c542ab
buffer: remove a wrongly added attribute specifier
hujiajie Jul 24, 2017
1232d9d
linkedlist: correct grammar in comments
alexbostock Jul 30, 2017
9132f37
test: add check on an addon that does not register
ezequielgarcia Jun 28, 2017
435ab00
test: refactor test-vm-new-script-new-context
Trott Jul 29, 2017
014a9bd
test: refactor test-domain-abort-on-uncaught
Trott Jul 30, 2017
071018e
src: use existing strings over creating new ones
addaleax Aug 2, 2017
403c465
doc: add gabrielschulhof to collaborators
Aug 8, 2017
567acf6
tools: update to ESLint 4.3.0
Trott Jul 21, 2017
1bba740
build: add cpp linting to windows build
Mar 15, 2017
78efc8c
build: split up cpplint to avoid long cmd lines
kfarnung Jul 6, 2017
180bec1
build: add lint option to vcbuild.bat help
brennemo Mar 22, 2017
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
Prev Previous commit
Next Next commit
test: remove common.noop
This change removes `common.noop` from the Node.js internal testing
common module.

Over the last few weeks, I've grown to dislike the `common.noop`
abstraction.

First, new (and experienced) contributors are unaware of it and so it
results in a large number of low-value nits on PRs. It also increases
the number of things newcomers and infrequent contributors have to be
aware of to be effective on the project.

Second, it is confusing. Is it a singleton/property or a getter? Which
should be expected? This can lead to subtle and hard-to-find bugs. (To
my knowledge, none have landed on master. But I also think it's only a
matter of time.)

Third, the abstraction is low-value in my opinion. What does it really
get us? A case could me made that it is without value at all.

Lastly, and this is minor, but the abstraction is wordier than not using
the abstraction. `common.noop` doesn't save anything over `() => {}`.

So, I propose removing it.

PR-URL: #12822
Backport-PR-URL: #14174
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed Aug 16, 2017
commit 3bd0c7cad794a5e9fd78a25e205da56db0296036
21 changes: 4 additions & 17 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,26 @@ Gets IP of localhost
Array of IPV6 hosts.

### mustCall([fn][, exact])
* `fn` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = `common.noop`
* `fn` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {}
* `exact` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1
* return [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)

Returns a function that calls `fn`. If the returned function has not been called
exactly `expected` number of times when the test is complete, then the test will
fail.

If `fn` is not provided, `common.noop` will be used.
If `fn` is not provided, an empty function will be used.

### mustCallAtLeast([fn][, minimum])
* `fn` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = `common.noop`
* `fn` [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) default = () => {}
* `minimum` [&lt;Number>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) default = 1
* return [&lt;Function>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)

Returns a function that calls `fn`. If the returned function has not been called
at least `minimum` number of times when the test is complete, then the test will
fail.

If `fn` is not provided, `common.noop` will be used.
If `fn` is not provided, an empty function will be used.

### mustNotCall([msg])
* `msg` [&lt;String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) default = 'function should not have been called'
Expand All @@ -217,19 +217,6 @@ Returns a function that triggers an `AssertionError` if it is invoked. `msg` is

Returns `true` if the exit code `exitCode` and/or signal name `signal` represent the exit code and/or signal name of a node process that aborted, `false` otherwise.

### noop

A non-op `Function` that can be used for a variety of scenarios.

For instance,

<!-- eslint-disable strict, no-undef -->
```js
const common = require('../common');

someAsyncAPI('foo', common.mustCall(common.noop));
```

### opensslCli
* return [&lt;Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)

Expand Down
1 change: 0 additions & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const testRoot = process.env.NODE_TEST_DIR ?

const noop = () => {};

exports.noop = noop;
exports.fixturesDir = path.join(__dirname, '..', 'fixtures');
exports.tmpDirName = 'tmp';
// PORT should match the definition in test/testpy/__init__.py.
Expand Down
4 changes: 2 additions & 2 deletions test/debugger/test-debugger-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ addTest(function(client, done) {

let connectCount = 0;
const script = 'setTimeout(function() { console.log("blah"); });' +
'setInterval(common.noop, 1000000);';
'setInterval(() => {}, 1000000);';

let nodeProcess;

Expand Down Expand Up @@ -172,7 +172,7 @@ function doTest(cb, done) {
console.error('>>> connecting...');
c.connect(debug.port);
c.on('break', function() {
c.reqContinue(common.noop);
c.reqContinue(() => {});
});
c.on('ready', function() {
connectCount++;
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-assert.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const a = require('assert');

Expand Down Expand Up @@ -515,7 +515,7 @@ testAssertionMessage(/a/, '/a/');
testAssertionMessage(/abc/gim, '/abc/gim');
testAssertionMessage(function f() {}, '[Function: f]');
testAssertionMessage(function() {}, '[Function]');
testAssertionMessage(common.noop, '[Function: noop]');
testAssertionMessage(() => {}, '[Function]');
testAssertionMessage({}, '{}');
testAssertionMessage(circular, '{ y: 1, x: [Circular] }');
testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }');
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-rr-domain-listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const domain = require('domain');

if (cluster.isWorker) {
const d = domain.create();
d.run(function() { });
d.run(() => {});

const http = require('http');
http.Server(function() { }).listen(0, '127.0.0.1');
http.Server(() => {}).listen(0, '127.0.0.1');

} else if (cluster.isMaster) {
let worker;
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-worker-wait-server-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (cluster.isWorker) {
const server = net.createServer(function(socket) {
// Wait for any data, then close connection
socket.write('.');
socket.on('data', function discard() {});
socket.on('data', () => {});
}).listen(0, common.localhostIPv4);

server.once('close', function() {
Expand All @@ -20,7 +20,7 @@ if (cluster.isWorker) {

// Although not typical, the worker process can exit before the disconnect
// event fires. Use this to keep the process open until the event has fired.
const keepOpen = setInterval(common.noop, 9999);
const keepOpen = setInterval(() => {}, 9999);

// Check worker events and properties
process.once('disconnect', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ global.gc = 42; // Not a valid global unless --expose_gc is set.
assert.deepStrictEqual(common.leakedGlobals(), ['gc']);

assert.throws(function() {
common.mustCall(common.noop, 'foo');
common.mustCall(() => {}, 'foo');
}, /^TypeError: Invalid exact value: foo$/);

assert.throws(function() {
common.mustCall(common.noop, /foo/);
common.mustCall(() => {}, /foo/);
}, /^TypeError: Invalid exact value: \/foo\/$/);

const fnOnce = common.mustCall(() => {});
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/;
[crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) {
[-1, undefined, null, false, true, {}, []].forEach(function(value) {
assert.throws(function() { f(value); }, expectedErrorRegexp);
assert.throws(function() { f(value, common.noop); }, expectedErrorRegexp);
assert.throws(function() { f(value, () => {}); }, expectedErrorRegexp);
});

[0, 1, 2, 4, 16, 256, 1024].forEach(function(len) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-env-var-no-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (process.argv[2] === 'child') {
test({ NODE_NO_WARNINGS: false });
test({ NODE_NO_WARNINGS: {} });
test({ NODE_NO_WARNINGS: [] });
test({ NODE_NO_WARNINGS: common.noop });
test({ NODE_NO_WARNINGS: () => {} });
test({ NODE_NO_WARNINGS: 0 });
test({ NODE_NO_WARNINGS: -1 });
test({ NODE_NO_WARNINGS: '0' });
Expand Down
32 changes: 16 additions & 16 deletions test/parallel/test-event-emitter-check-listener-leaks.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const events = require('events');

let e = new events.EventEmitter();

// default
for (let i = 0; i < 10; i++) {
e.on('default', common.noop);
e.on('default', () => {});
}
assert.ok(!e._events['default'].hasOwnProperty('warned'));
e.on('default', common.noop);
e.on('default', () => {});
assert.ok(e._events['default'].warned);

// symbol
const symbol = Symbol('symbol');
e.setMaxListeners(1);
e.on(symbol, common.noop);
e.on(symbol, () => {});
assert.ok(!e._events[symbol].hasOwnProperty('warned'));
e.on(symbol, common.noop);
e.on(symbol, () => {});
assert.ok(e._events[symbol].hasOwnProperty('warned'));

// specific
e.setMaxListeners(5);
for (let i = 0; i < 5; i++) {
e.on('specific', common.noop);
e.on('specific', () => {});
}
assert.ok(!e._events['specific'].hasOwnProperty('warned'));
e.on('specific', common.noop);
e.on('specific', () => {});
assert.ok(e._events['specific'].warned);

// only one
e.setMaxListeners(1);
e.on('only one', common.noop);
e.on('only one', () => {});
assert.ok(!e._events['only one'].hasOwnProperty('warned'));
e.on('only one', common.noop);
e.on('only one', () => {});
assert.ok(e._events['only one'].hasOwnProperty('warned'));

// unlimited
e.setMaxListeners(0);
for (let i = 0; i < 1000; i++) {
e.on('unlimited', common.noop);
e.on('unlimited', () => {});
}
assert.ok(!e._events['unlimited'].hasOwnProperty('warned'));

Expand All @@ -49,26 +49,26 @@ events.EventEmitter.defaultMaxListeners = 42;
e = new events.EventEmitter();

for (let i = 0; i < 42; ++i) {
e.on('fortytwo', common.noop);
e.on('fortytwo', () => {});
}
assert.ok(!e._events['fortytwo'].hasOwnProperty('warned'));
e.on('fortytwo', common.noop);
e.on('fortytwo', () => {});
assert.ok(e._events['fortytwo'].hasOwnProperty('warned'));
delete e._events['fortytwo'].warned;

events.EventEmitter.defaultMaxListeners = 44;
e.on('fortytwo', common.noop);
e.on('fortytwo', () => {});
assert.ok(!e._events['fortytwo'].hasOwnProperty('warned'));
e.on('fortytwo', common.noop);
e.on('fortytwo', () => {});
assert.ok(e._events['fortytwo'].hasOwnProperty('warned'));

// but _maxListeners still has precedence over defaultMaxListeners
events.EventEmitter.defaultMaxListeners = 42;
e = new events.EventEmitter();
e.setMaxListeners(1);
e.on('uno', common.noop);
e.on('uno', () => {});
assert.ok(!e._events['uno'].hasOwnProperty('warned'));
e.on('uno', common.noop);
e.on('uno', () => {});
assert.ok(e._events['uno'].hasOwnProperty('warned'));

// chainable
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-event-emitter-get-max-listeners.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const common = require('../common');
require('../common');
const assert = require('assert');
const EventEmitter = require('events');

Expand All @@ -15,5 +15,5 @@ assert.strictEqual(emitter.getMaxListeners(), 3);

// https://github.com/nodejs/node/issues/523 - second call should not throw.
const recv = {};
EventEmitter.prototype.on.call(recv, 'event', common.noop);
EventEmitter.prototype.on.call(recv, 'event', common.noop);
EventEmitter.prototype.on.call(recv, 'event', () => {});
EventEmitter.prototype.on.call(recv, 'event', () => {});
10 changes: 5 additions & 5 deletions test/parallel/test-event-emitter-listener-count.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use strict';

const common = require('../common');
require('../common');
const assert = require('assert');
const EventEmitter = require('events');

const emitter = new EventEmitter();
emitter.on('foo', common.noop);
emitter.on('foo', common.noop);
emitter.on('baz', common.noop);
emitter.on('foo', () => {});
emitter.on('foo', () => {});
emitter.on('baz', () => {});
// Allow any type
emitter.on(123, common.noop);
emitter.on(123, () => {});

assert.strictEqual(EventEmitter.listenerCount(emitter, 'foo'), 2);
assert.strictEqual(emitter.listenerCount('foo'), 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 null listeners added.'));
}));

e.on(null, common.noop);
e.on(null, common.noop);
e.on(null, () => {});
e.on(null, () => {});
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 Symbol(symbol) listeners added.'));
}));

e.on(symbol, common.noop);
e.on(symbol, common.noop);
e.on(symbol, () => {});
e.on(symbol, () => {});
6 changes: 3 additions & 3 deletions test/parallel/test-event-emitter-max-listeners-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ process.on('warning', common.mustCall((warning) => {
assert.ok(warning.message.includes('2 event-type listeners added.'));
}));

e.on('event-type', common.noop);
e.on('event-type', common.noop); // Trigger warning.
e.on('event-type', common.noop); // Verify that warning is emitted only once.
e.on('event-type', () => {});
e.on('event-type', () => {}); // Trigger warning.
e.on('event-type', () => {}); // Verify that warning is emitted only once.
6 changes: 3 additions & 3 deletions test/parallel/test-event-emitter-remove-all-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ function listener() {}
ee.on('removeListener', function(name, listener) {
assert.strictEqual(expectLength--, this.listeners('baz').length);
});
ee.on('baz', common.noop);
ee.on('baz', common.noop);
ee.on('baz', common.noop);
ee.on('baz', () => {});
ee.on('baz', () => {});
ee.on('baz', () => {});
assert.strictEqual(ee.listeners('baz').length, expectLength + 1);
ee.removeAllListeners('baz');
assert.strictEqual(ee.listeners('baz').length, 0);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-event-emitter-subclass.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ MyEE2.prototype = new EventEmitter();
const ee1 = new MyEE2();
const ee2 = new MyEE2();

ee1.on('x', common.noop);
ee1.on('x', () => {});

assert.strictEqual(ee2.listenerCount('x'), 0);
2 changes: 1 addition & 1 deletion test/parallel/test-fs-buffertype-writesync.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const fs = require('fs');
const path = require('path');

const filePath = path.join(common.tmpDir, 'test_buffer_type');
const v = [true, false, 0, 1, Infinity, common.noop, {}, [], undefined, null];
const v = [true, false, 0, 1, Infinity, () => {}, {}, [], undefined, null];

common.refreshTmpDir();

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-fs-mkdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ common.refreshTmpDir();

// Keep the event loop alive so the async mkdir() requests
// have a chance to run (since they don't ref the event loop).
process.nextTick(common.noop);
process.nextTick(() => {});
6 changes: 3 additions & 3 deletions test/parallel/test-fs-read-stream-inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ let paused = false;
let file7 =
fs.createReadStream(rangeFile, Object.create({autoClose: false }));
assert.strictEqual(file7.autoClose, false);
file7.on('data', common.noop);
file7.on('data', () => {});
file7.on('end', common.mustCall(function() {
process.nextTick(common.mustCall(function() {
assert(!file7.closed);
Expand Down Expand Up @@ -169,7 +169,7 @@ let paused = false;
{
const options = Object.create({fd: 13337, autoClose: false});
const file8 = fs.createReadStream(null, options);
file8.on('data', common.noop);
file8.on('data', () => {});
file8.on('error', common.mustCall());
process.on('exit', function() {
assert(!file8.closed);
Expand All @@ -181,7 +181,7 @@ let paused = false;
// Make sure stream is destroyed when file does not exist.
{
const file9 = fs.createReadStream('/path/to/file/that/does/not/exist');
file9.on('data', common.noop);
file9.on('data', () => {});
file9.on('error', common.mustCall());

process.on('exit', function() {
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-fs-read-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pauseRes.pause();
pauseRes.resume();

let file7 = fs.createReadStream(rangeFile, {autoClose: false });
file7.on('data', common.noop);
file7.on('data', () => {});
file7.on('end', function() {
process.nextTick(function() {
assert(!file7.closed);
Expand All @@ -161,12 +161,12 @@ function file7Next() {

// Just to make sure autoClose won't close the stream because of error.
const file8 = fs.createReadStream(null, {fd: 13337, autoClose: false });
file8.on('data', common.noop);
file8.on('data', () => {});
file8.on('error', common.mustCall());

// Make sure stream is destroyed when file does not exist.
const file9 = fs.createReadStream('/path/to/file/that/does/not/exist');
file9.on('data', common.noop);
file9.on('data', () => {});
file9.on('error', common.mustCall());

process.on('exit', function() {
Expand Down
Loading