fix: repair failing tests and type errors across monorepo - #114
Open
stooit wants to merge 1 commit into
Open
Conversation
…nd sort closure - bunfig.toml: preload happy-dom setup from repo root (the 'environment' key is not a real Bun option and was silently ignored, so bare 'bun test' had no DOM). Fixes 9 'document is not defined' failures. - apps/web/src/lib/api.ts: hook renamed useThrottle -> useDebounce in @e2e/utils; fix import and useSearchDebounce re-export. - packages/utils/src/format/date.ts: formatDate used en-AU which hard-pads the day (01/03/2024); switch to en-GB numeric day (1/03/2024). - tsconfig.json: add bun-types to compilerOptions.types to resolve 'Cannot find module bun:test'. - Button.tsx: always emit an accessible name via aria-label for icon-only buttons, with a dev warning when none is supplied (WCAG 4.1.2). - DataTable.tsx: unify sortKey/sortDir into one state object updated via a single functional updater, fixing the stale-closure sort toggle. No test files or dependencies changed. bun test: 13/13 pass; tsc --noEmit clean.
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.
Summary
Fixes all failing tests and type errors in the monorepo.
bun testnow reports 13/13 pass (was 4/13) andtsc --noEmitexits clean (was 5 errors). No test files were modified and no dependencies were added.Root causes & fixes
bunfig.tomlenvironment = "happy-dom"is not a real Bun config key — silently ignored, so barebun testhad no DOM (9 xdocument is not defined).packages/ui/test/setup.tshappy-dom registrator from the repo root.apps/web/src/lib/api.tsuseThrottle->useDebouncein@e2e/utils; stale import broke tsc and theuseSearchDebounceexport test.useDebounce.packages/utils/src/format/date.tsformatDateuseden-AU, which hard zero-pads the day (01/03/2024); test expects1/03/2024.en-GBwith{ day: "numeric", month: "2-digit", year: "numeric" }.tsconfig.jsonCannot find module 'bun:test'."types": ["bun-types"](already installed).packages/ui/.../Button.tsxaria-label; dev-onlyconsole.warnwhen an icon-only button is given no label.packages/ui/.../DataTable.tsxsortKey/sortDirinto one state object driven by a single functional updater.Verification
bun test-> 13 pass, 0 failnpx tsc --noEmit-> exit 0Assumptions & follow-up notes (out of scope, driven by "don't modify tests / fix only what tests require")
date.tslocale: Noen-AUoption set can satisfy the test (en-AU always zero-pads the day), soen-GBwas required. LeavesformatDate(en-GB) andformatDateTime(en-AU) inconsistent — flagged for the test owner.Buttonfallback label: Makingaria-labeltype-required wheniconOnlywould break tsc on an unmodifiable test; runtime fallback + dev warning is the correct trade-off here.tsconfigtypes: an allowlist; future consumers relying on ambient@types/*may need them re-added.