-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: improve the code in test-fs-read-stream #10556
Conversation
const fd = fs.openSync(file, 'r'); | ||
const stream = fs.createReadStream(null, { fd: fd, encoding: 'utf8' }); | ||
|
||
stream.on('data', common.mustCall((data) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the common.mustCall()
should be removed since there could be more than one 'data'
event and we're already verifying the output on process exit anyway.
|
||
process.on('exit', function() { | ||
process.on('exit', () => { | ||
fs.unlinkSync(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're in here editing the file, can you please remove fs.unlinkSync(file);
? (There's no need for tests to clean up the temp dir on exit as all tests that use the temp dir should refresh it before using it.)
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if CI is ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions
solved the conflicts after ff1efa6 , please set the CI again |
Landed 7a46b99 |
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: #10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: nodejs#10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: nodejs#10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: #10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: nodejs#10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* use const and let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: nodejs#10556 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test