Enhance test coverage with helpers + platform-agnostic watcher tests#728
Merged
JohnTitor merged 1 commit intonotify-rs:mainfrom Nov 5, 2025
Merged
Enhance test coverage with helpers + platform-agnostic watcher tests#728JohnTitor merged 1 commit intonotify-rs:mainfrom
JohnTitor merged 1 commit intonotify-rs:mainfrom
Conversation
c714b4d to
5746f9e
Compare
3e1f9f8 to
286bccf
Compare
JohnTitor
approved these changes
Nov 5, 2025
Member
JohnTitor
left a comment
There was a problem hiding this comment.
Great hardening, thank you!
Closed
sapphi-red
pushed a commit
to rolldown/notify
that referenced
this pull request
Nov 13, 2025
Merged
Boshen
added a commit
to rolldown/notify
that referenced
this pull request
Nov 16, 2025
## 🤖 New release * `rolldown-notify-types`: 2.0.0 -> 2.0.1 (✓ API compatible changes) * `rolldown-notify`: 8.2.0 -> 8.2.1 (✓ API compatible changes) * `rolldown-file-id`: 0.2.3 -> 0.2.4 (✓ API compatible changes) * `rolldown-notify-debouncer-full`: 0.6.0 -> 0.6.1 (✓ API compatible changes) * `rolldown-notify-debouncer-mini`: 0.7.0 -> 0.7.1 <details><summary><i><b>Changelog</b></i></summary><p> ## `rolldown-notify-types` <blockquote> ## [2.0.1](rolldown-notify-types-v2.0.0...rolldown-notify-types-v2.0.1) - 2025-11-16 ### Other - update rust toolchain to 1.90.0 </blockquote> ## `rolldown-notify` <blockquote> ## [8.2.1](rolldown-notify-v8.2.0...rolldown-notify-v8.2.1) - 2025-11-16 ### Fixed - emit `remove` event if add watch fails due to non-existing path for kqueue watcher ([#6](#6)) - throw fsevents stream start error properly ([#4](#4)) ### Other - add kqueue tests ([#5](#5)) - reuse the same `ReadDirectoryChangesW` handle for watching a file in the same directory ([#3](#3)) - migrate to rust edition 2024 ([#2](#2)) - add benchmark for .paths_mut ([#1](#1)) - fix test failure with macOS kqueue - add test helpers and tests ([notify-rs#728](https://github.com/rolldown/notify/pull/728)) - `FsEventWatcher` crashes when dealing with empty path ([notify-rs#718](https://github.com/rolldown/notify/pull/718)) - update rust toolchain to 1.90.0 </blockquote> ## `rolldown-file-id` <blockquote> ## [0.2.4](rolldown-file-id-v0.2.3...rolldown-file-id-v0.2.4) - 2025-11-16 ### Other - migrate to rust edition 2024 ([#2](#2)) </blockquote> ## `rolldown-notify-debouncer-full` <blockquote> ## [0.6.1](rolldown-notify-debouncer-full-v0.6.0...rolldown-notify-debouncer-full-v0.6.1) - 2025-11-16 ### Other - migrate to rust edition 2024 ([#2](#2)) </blockquote> ## `rolldown-notify-debouncer-mini` <blockquote> ## [0.7.1](rolldown-notify-debouncer-mini-v0.7.0...rolldown-notify-debouncer-mini-v0.7.1) - 2025-11-16 ### Other - updated the following local packages: rolldown-notify-types, rolldown-notify </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
boenrobot
pushed a commit
to boenrobot/notify
that referenced
this pull request
Jan 5, 2026
JohnTitor
pushed a commit
that referenced
this pull request
Jan 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces test helpers and new integration tests for watchers.
testmodule containing reusable utilities (e.g.,testdir(),channel(),TestWatcher,Receiver,expected()) to streamline writing and maintaining file-system event tests. I think it is the main point of an interestRecommendedWatcherfn poll_senderfor thePollWatcher, but it has#[cfg(test)]eitherThe tests already have found bugs: #727, #729
Remark: surprisingly, poll watcher is the most flaky due to a slow file system - the file may still appear in an immediate
readdirresult. Because of that, I had to introduce a small helper I didn’t really want to:sleep_until.PollWatchertests follow the patternwatch -- do something -- wait for fs state -- detect changes -- check, which seems reliable enough.@dfaust I think I've done it
The main point to check is test helpers in
notify/src/test.rs, I tried to make it clear and simple, but I'm not sure.The tests follow the pattern
testdir()- it is required due to macos behaviour, where theTempDirhas non-canonicalized path, but we trigger it canonicalized in eventsTestWatcher+Receiver.TestWatcher<W: Watcher>is a simple helper panicking onErrfromwatchcallsReceiveris a rx-part of thempsc::channeland used to wait new eventswait_method onReceiver:wait_ordered- wait events in the same order as its providedwait_unordered- wait events in the same order as its providedwait_..._exact- as above, but panics if encountered an unexpected oneThe main idea to compare events is
test::expectmodule. It introducesExpectedEvent- a helper, that can be used toPartialEq<Event>. It may be created in any way, likeexpected(path)matches any event with the specifiedpath,expected(path).modify()matches an event with an equalpathsandEventKind::Modify(_),expected(path).modify_content_any()matchespathandModify(Content(Any))and so onevent(path)/event([path1, path2])- fn to create expected event from something path-like (&Path,PathBuf,[&Path]etc.)ExpectedState/trait ExpectedCollectionare helpers to check a collection ofExpectedEvent.It may be ordered, may handle optional and multiple events and make well-read panic messages (The example from CI)