test: refactor test-fs-read-stream-inherit#13618
Conversation
* block scope `paused` * change name of block-scoped `file3` etc. to `file` * alphabetize modules * confirm contents provided in `data` callback * confirm `data` callbacks will not fire on tests for errors
| file3.on('data', function(data) { | ||
| const file = fs.createReadStream(fn, Object.create({encoding: 'utf8'})); | ||
| file.length = 0; | ||
| file.on('data', function(data) { |
There was a problem hiding this comment.
Do we have any preferences whether to use lambdas or good old function declarations when they are interchangeable?
There was a problem hiding this comment.
By lambdas you mean () => {} (fat arrow) functions? I don't think we have an official policy (although I personally prefer fat arrow functions because they seem simpler).
There was a problem hiding this comment.
@gibfahn Exactly, that would be my preference as well.
| file5.on('end', common.mustCall(function() { | ||
| assert.strictEqual(file5.data, 'yz\n'); | ||
| file.on('end', common.mustCall(function() { | ||
| assert.strictEqual(file.data, 'yz\n'); |
There was a problem hiding this comment.
If you're here could you parameterize the 'yz\n', here and in L106
| file7Next(); | ||
| assert(!file.closed); | ||
| assert(!file.destroyed); | ||
| assert.strictEqual(data, 'xyz\n'); |
| file7.data = ''; | ||
| file7.on('data', function(data) { | ||
| file7.data += data; | ||
| file = fs.createReadStream(null, Object.create({fd: file.fd, start: 0 })); |
There was a problem hiding this comment.
this is just weird, shadowing file but AFAICT only affects L147-8 , so there it asserts the state of this file 🤔
IMHO it's wrong, but maybe not for this PR...
|
Landed in 3c506af |
* block scope `paused` * change name of block-scoped `file3` etc. to `file` * alphabetize modules * confirm contents provided in `data` callback * confirm `data` callbacks will not fire on tests for errors PR-URL: nodejs#13618 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* block scope `paused` * change name of block-scoped `file3` etc. to `file` * alphabetize modules * confirm contents provided in `data` callback * confirm `data` callbacks will not fire on tests for errors PR-URL: #13618 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* block scope `paused` * change name of block-scoped `file3` etc. to `file` * alphabetize modules * confirm contents provided in `data` callback * confirm `data` callbacks will not fire on tests for errors PR-URL: #13618 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace do-not-land if it is being backported |
pausedfile3etc. tofiledatacallbackdatacallbacks will not fire on tests for errorsChecklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test fs