-
Notifications
You must be signed in to change notification settings - Fork 30k
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: add fs-assert-encoding's test #10913
test: add fs-assert-encoding's test #10913
Conversation
new RegExp(`^Error: Unknown encoding: ${options}$`); | ||
|
||
assert.throws(() => { | ||
fs.readFile('path', options, () => {}); |
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.
Can you create a noop
variable, give it the value of () => {}
, then just reuse that.
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.
Updated:)
a652769
to
96b89c1
Compare
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.
One more small nit, but LGTM
const options = 'test'; | ||
const noop = () => {}; | ||
const unknownEncodingMessage = | ||
new RegExp(`^Error: Unknown encoding: ${options}$`); |
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.
Since options
never changes, you can just use test
in the regex, and use a literal instead of the RegExp()
constructor.
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.
Updated.
Check the error of `assertEncoding`. Confirmed in every place being used.(a place where `getoptions` is used) assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18
96b89c1
to
1f6fd2f
Compare
|
Ops I messed up. |
@lpinca you can still |
@gibfahn yes thanks, but I only closed the wrong PR by mistake :) |
@lpinca Can I merge to master? |
@abouthiroppy sure. |
|
Yes, there are some failures on |
Check the error of `assertEncoding`. Confirmed in every place being used.(a place where `getoptions` is used) assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18 PR-URL: #10913 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in 9db8973. |
Check the error of `assertEncoding`. Confirmed in every place being used.(a place where `getoptions` is used) assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18 PR-URL: nodejs#10913 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Check the error of `assertEncoding`. Confirmed in every place being used.(a place where `getoptions` is used) assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18 PR-URL: nodejs#10913 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This is not landing cleanly on v6 or v4. Backport? |
Test fails on both v4 and v6 btw |
Check the error of
assertEncoding
.Confirmed in every place being used.(a place where getOptions is used)
assetEncoding:
node/lib/internal/fs.js
Line 18 in 521767c
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test