You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two renderer tests assert that a context hook throws when used outside its provider, and they do it two different ways:
tests/renderer-dom/configContextSlices.test.tsx:167 lets the render throw escape and silences the fallout: vi.spyOn(console, "error").mockImplementation(() => {}) plus a windowerror listener that calls preventDefault().
The catch-inside approach from #264 is the better one. It does not depend on jsdom's window error machinery or on Vitest's global error-listener bookkeeping, and it fails loudly if a future edit lets the throw escape again. #264 explains why the escaping form is a run-level flake risk.
Proposed, test-only, no production change:
Move configContextSlices.test.tsx:167 to the same catch-inside pattern.
useNotificationsContext (src/renderer/src/contexts/NotificationsContext.tsx:145) has no outside-provider test at all. Add one in the same style so that guard branch is covered.
Two renderer tests assert that a context hook throws when used outside its provider, and they do it two different ways:
tests/renderer-dom/configContextSlices.test.tsx:167lets the render throw escape and silences the fallout:vi.spyOn(console, "error").mockImplementation(() => {})plus awindowerrorlistener that callspreventDefault().tests/renderer-dom/taskManagerFlows.test.tsx(after test(renderer): keep the TaskProvider guard throw inside the component #264) catches the throw inside the render callback so React never runs its guarded replay, then assertsconsole.errorwas not called as a regression pin.The catch-inside approach from #264 is the better one. It does not depend on jsdom's window error machinery or on Vitest's global error-listener bookkeeping, and it fails loudly if a future edit lets the throw escape again. #264 explains why the escaping form is a run-level flake risk.
Proposed, test-only, no production change:
configContextSlices.test.tsx:167to the same catch-inside pattern.useNotificationsContext(src/renderer/src/contexts/NotificationsContext.tsx:145) has no outside-provider test at all. Add one in the same style so that guard branch is covered.