Repository navigation
Conversation
This replace all `var` occurrences in test-file-write-stream.js with `const` (where they are not being reassigned) and `let` (where they are being reassigned).
This add strict comparison to the asserts and if statements:
- Replace `assert.equal` with `assert.strictEqual` where:
1. Result of `typeof` being compared to a string literal.
2. Result of `fs.readFileSync` with UTF-8 encoding being compared to
a string constant.
- Replace `==` with `===` where integer values are being compared to
integer literals.
| for (let i = 0; i < 11; i++) { | ||
| (function(i) { | ||
| file.write('' + i); | ||
| })(i); |
There was a problem hiding this comment.
I think this can be simplified by removing the IIFE
There was a problem hiding this comment.
Removed the IIFE, Thanks for pointing it out.
| process.on('exit', function() { | ||
| for (var k in callbacks) { | ||
| for (const k in callbacks) { | ||
| assert.equal(0, callbacks[k], k + ' count off by ' + callbacks[k]); |
There was a problem hiding this comment.
Nit: how about using strictEqual and a template literal here?
There was a problem hiding this comment.
Thanks for pointing it out. Updated it.
This replace a `assert.equal` with a `assert.strictEqual` which was missed in previous commit.
|
LGTM if CI doesn't reveal any issues with the test. Looping in @thealphanerd in case they have an opinion about the introduction of |
addaleax
left a comment
There was a problem hiding this comment.
LGTM, and fwiw I’m perfectly fine with let here.
|
CI failures are unrelated known flaky tests. Landing. |
Replace all `var` occurrences in test-file-write-stream.js with
`const` (where they are not being reassigned) and `let` (where they are
being reassigned).
Add strict comparison to the asserts and if statements:
- Replace `assert.equal` with `assert.strictEqual` where:
1. Result of `typeof` being compared to a string literal.
2. Result of `fs.readFileSync` with UTF-8 encoding being compared to
a string constant.
- Replace `==` with `===` where integer values are being compared to
integer literals.
Remove unnecessary very IIFE.
Use template literals.
PR-URL: nodejs#8894
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
Landed in 1d4ba1b |
Replace all `var` occurrences in test-file-write-stream.js with
`const` (where they are not being reassigned) and `let` (where they are
being reassigned).
Add strict comparison to the asserts and if statements:
- Replace `assert.equal` with `assert.strictEqual` where:
1. Result of `typeof` being compared to a string literal.
2. Result of `fs.readFileSync` with UTF-8 encoding being compared to
a string constant.
- Replace `==` with `===` where integer values are being compared to
integer literals.
Remove unnecessary very IIFE.
Use template literals.
PR-URL: #8894
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Replace all `var` occurrences in test-file-write-stream.js with
`const` (where they are not being reassigned) and `let` (where they are
being reassigned).
Add strict comparison to the asserts and if statements:
- Replace `assert.equal` with `assert.strictEqual` where:
1. Result of `typeof` being compared to a string literal.
2. Result of `fs.readFileSync` with UTF-8 encoding being compared to
a string constant.
- Replace `==` with `===` where integer values are being compared to
integer literals.
Remove unnecessary very IIFE.
Use template literals.
PR-URL: #8894
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
Description of change
Some trivial changes to improve the test code in
test/parallel/test-file-write-stream.js.Submitting this as my first contribution as per instructions from NodeTodo.