-
Notifications
You must be signed in to change notification settings - Fork 31k
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
lib: fix handling of non-object options parameter in fs/watchFile #54157
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #54157 +/- ##
=======================================
Coverage 87.08% 87.09%
=======================================
Files 647 647
Lines 181974 181983 +9
Branches 34915 34918 +3
=======================================
+ Hits 158473 158495 +22
+ Misses 16787 16779 -8
+ Partials 6714 6709 -5
|
1e313f6
to
092b9d1
Compare
lib/fs.js
Outdated
listener = options; | ||
options = null; | ||
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.
options = {}; | |
options = kEmptyObject; |
Could you add a test by referring to the following? node/test/parallel/test-fs-watchfile.js Lines 10 to 27 in 00c0644
|
9a19dbd
to
2535918
Compare
lib/fs.js
Outdated
options = kEmptyObject; | ||
} | ||
|
||
if (!listener) { |
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.
IIUC, when null, 0, false, or NaN is passed to the listener, the error message won't print the value properly.
if (!listener) { | |
if (listener === undefined) { |
389b951
to
2b53545
Compare
@kimtaejin3 Please check linter errors. It looks unnecessary changes are added. |
2b53545
to
2117476
Compare
2117476
to
b97b1ae
Compare
Problem I resolved
It causes TypeError:
I think
The "options" argument must be of type object ...
is correct error message instead ofThe "listener" argument must be of type function. Received type string ('string')
. so I fixed it