test(core): force deterministic fs.watch failure with NUL-byte path
Prior attempt accepted either fs.watch failure path (sync throw vs async error event) — but on Linux Node, fs.watch with `recursive: true` on a missing directory silently succeeds (returns a no-op watcher, never throws, never emits an error). Neither catch arm fires, so the warning the test wants to assert never appears. Switch to a NUL-byte-embedded path. Node validates the path argument up front and throws ERR_INVALID_ARG_VALUE synchronously on every platform, guaranteeing the `watch:fs-watch-setup` catch arm runs. Restore the strict assertions on phase + message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -812,37 +812,28 @@ describe("TaskStore", () => {
|
||||
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
|
||||
const storeAny = store as any;
|
||||
const originalTasksDir = storeAny.tasksDir;
|
||||
storeAny.tasksDir = join(rootDir, ".fusion", "missing-tasks-dir");
|
||||
// Force fs.watch to throw synchronously on every platform. A non-
|
||||
// existent directory only fails reliably on macOS — Linux Node with
|
||||
// `recursive: true` silently returns a no-op watcher (no sync throw,
|
||||
// no async error event), so the catch arm we want to exercise never
|
||||
// fires. Embedding a NUL byte makes Node reject the path argument
|
||||
// up front with ERR_INVALID_ARG_VALUE, which is platform-agnostic.
|
||||
const invalidTasksDir = join(rootDir, ".fusion", "missing-tasks-dir") + " | ||||