test: improve the code in test-fs-null-bytes#10521
test: improve the code in test-fs-null-bytes#10521edsadr wants to merge 1 commit intonodejs:masterfrom
Conversation
test/parallel/test-fs-null-bytes.js
Outdated
There was a problem hiding this comment.
Nit: I think that wrapping this with common.mustCall() is useless as it would only be wrapped when sync is truthy.
test/parallel/test-fs-null-bytes.js
Outdated
There was a problem hiding this comment.
Nit: can we use /^Error: Path must be a string without null bytes$/?
There was a problem hiding this comment.
@lpinca , removed the unnecessary common.mustCall, but this one is asserting against the error message and the error message is exactly that one: https://github.com/nodejs/node/blob/master/lib/fs.js#L118
There was a problem hiding this comment.
Yes, other tests use the full message with boundaries, ^$, and I would like to be consistent here.
There was a problem hiding this comment.
@lpinca this test is using that variable twice to validate the error, one of these is an assert.throws if I set the boundaries that one will fail, I could use 2 different vars to test the error... but... not sure if worth it?
There was a problem hiding this comment.
@edsadr you are right, I missed that other assertion. I think it's fine to keep it as is then. Sorry for the confusion.
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error
|
Landed in 6830849. |
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: #10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: nodejs#10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: nodejs#10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: nodejs#10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: nodejs#10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: #10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
* use const instead of var * use common.mustCall to control functions execution * use assert.strictEqual instead of assert.equal * use arrow functions * remove console.error PR-URL: #10521 Reviewed-By: Prince John Wesley <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test
Description of change