-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
test: deflake test-fs-promises-watch-iterator #60060
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
base: main
Are you sure you want to change the base?
Conversation
Add a delay before writing the files to ensure that the watcher receives the notifications. Fixes: nodejs#60051 Refs: nodejs#52601
for (const fileName of [...this.files]) { | ||
await writeFile(this.filePath(fileName), Date.now() + fileName.repeat(1e4)); | ||
} | ||
await setTimeout(common.platformTimeout(100)); |
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.
If there was a reason for this I will add it back, but I don't see it.
// Do the write with a delay to ensure that the OS is ready to notify us. | ||
await setTimeout(common.platformTimeout(100)); |
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.
The same is done in other fs.watch()
tests, for example:
node/test/parallel/test-fs-watch-recursive-add-file.js
Lines 41 to 44 in c6316f9
// Do the write with a delay to ensure that the OS is ready to notify us. | |
setTimeout(() => { | |
fs.writeFileSync(testFile, 'world'); | |
}, common.platformTimeout(200)); |
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.
Thank you!
lgtm
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60060 +/- ##
==========================================
- Coverage 88.45% 88.45% -0.01%
==========================================
Files 703 703
Lines 207546 207546
Branches 40011 39997 -14
==========================================
- Hits 183591 183575 -16
- Misses 15949 15955 +6
- Partials 8006 8016 +10 🚀 New features to boost your workflow:
|
Add a delay before writing the files to ensure that the watcher receives the notifications.
Fixes: #60051
Refs: #52601