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
{{ message }}
Repository navigation
[P1/test] Nine vi.mock paths resolve to nothing; those suites test the real modules #594
A test file in src/components/<area>/__tests__/ needs ../../../stores/x to reach src/stores/x. Nine mocks use ../../, which resolves to src/components/stores/x — a path that does not exist. Vitest does not error on an unresolvable vi.mock; it silently does nothing, so the suite runs against the real module and still passes.
Broken
src/components/backup/__tests__/RestoreDialog.test.tsx — ../../lib/sql-import, ../../lib/tauri-api, ../../stores/connectionStore (all three; the file mocks nothing it thinks it does)
The assertions are not measuring what they name. SaveFavoriteDialog.test.tsx was the first one caught: twelve tests had been exercising the real favoritesStore, and a new test that should have been trivial failed in a way that made no sense until the real store’s generated id turned up in the output. The others are the same shape and none of them have been caught yet, because a suite running against real modules mostly still passes.
Expected
Every vi.mock path resolves. Fixing the paths will surface assertions that were only passing by accident; those are real findings, not collateral.
Proposed fix
Correct the paths, then add a check so it cannot recur — a script in scripts/ walking vi.mock("…relative…") specifiers and failing on any that resolves to no file, wired into CI beside check-documented-commands.sh. A lint rule would be neater if one exists for this.
Acceptance
No vi.mock specifier in src/** resolves to a non-existent path; CI fails if one is added.
Activity
test: make nine vi.mock paths resolve, and stop it recurring