test: Add regression tests and
OutputWatchertrait to prepare for daemon removal fromturbo watch(#12171)Summary
- Defines the
OutputWatchertrait that will replaceDaemonClientinRunCache/TaskCachewhen we remove the daemon from watch mode- Adds regression tests that characterize current watch behavior and must stay green throughout the daemon removal refactor
What’s here
OutputWatchertrait (turborepo-run-cache): Abstractsget_changed_outputsandnotify_outputs_written— the two operationsTaskCacheuses to prevent infinite rebuild loops in watch mode. Currently these go through the daemon’s gRPC interface; the trait lets us swap in an in-processGlobWatcherwithout changingTaskCache.8 mock-based unit tests (
turborepo-run-cache): Characterize the trait contract — empty results, partial changes, error recovery for both get and notify, lifecycle round-trips, per-hash independence, and `Send
- Sync` compliance.
3 GlobWatcher delegation tests (
turborepo-filewatch): Verify thatGlobWatcher::watch_globs/get_changed_globssatisfy theOutputWatchercontract when called with raw strings andGlobSet::from_raw— the exact path the futureInProcessOutputWatcherwill use. Tests cover unchanged outputs, changed outputs, and exclusion glob handling.2 E2E watch tests (
watch_test.rs):
watch_no_spurious_rebuild_after_settle— After the initial build, no further rebuilds occur when no files change. Guards against infinite rebuild loops from cache restores triggering the file watcher.watch_same_content_write_does_not_rebuild— Writing identical content to a source file does not trigger a rebuild. Guards against hash-based deduplication regression.Testing
All 13 new tests pass locally. The 2 E2E tests are automatically serialized via the existing nextest
turbo-watch-serialgroup.
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Turborepo
Turborepo is a high-performance build system for JavaScript and TypeScript codebases, written in Rust.
Getting Started
Visit https://turborepo.dev to get started with Turborepo.
Contributing
See CONTRIBUTING.md for more information.
Community
The Turborepo community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.
To chat with other community members, you can join Vercel Community’s
#turborepotag.Our Code of Conduct applies to all Turborepo community channels.
Who is using Turborepo?
Turborepo is used by the world’s leading companies. Check out the Turborepo Showcase to learn more.
Updates
Follow @turborepo on X for project updates.
Security
If you believe you have found a security vulnerability in Turborepo, we encourage you to responsibly disclose this and not open a public issue. We will investigate all legitimate reports. Email
security@vercel.comto disclose any security vulnerabilities.https://vercel.com/security