fix: repair failing tests and type errors across monorepo - #157
Open
stooit wants to merge 1 commit into
Open
Conversation
- bunfig.toml: replace invalid 'environment' key with 'preload' so happy-dom registers and DOM globals exist under bun test (fixes 'document is not defined') - tsconfig.json: add 'bun-types' to types so 'bun:test' resolves (fixes TS2307) - utils/date.ts: format day-first with no leading zero on day via formatToParts - web/api.ts: rename removed useThrottle import to the current useDebounce export - ui/Button.tsx: apply aria-label for icon-only buttons; guard process.env and avoid masking the a11y defect with a bogus fallback label - ui/DataTable.tsx: use functional state updater for sort direction toggle
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
bun testtests andtsc --noEmittype errors across the monorepo. Final gate: 13 pass / 0 fail,tsc --noEmitexit 0. No test files,package.json, or lockfiles were modified; no dependencies added.Bugs fixed
bunfig.tomlenvironment = "happy-dom"is a Jest key that Bun silently ignores → all render tests threwdocument is not definedpreload = ["./packages/ui/test/setup.ts"]so happy-dom actually registers DOM globalstsconfig.jsonbun:testunresolved → TS2307 ×4"types": ["bun-types"](already installed)apps/web/src/lib/api.tsuseThrottlewhich no longer exists in@e2e/utils→ TS2305useDebounceexport (import + re-export); collapsed duplicate importspackages/utils/src/format/date.tsformatDateproduced01/03/2024; test expects day-first with no leading zero (1/03/2024)formatToPartsand strip the day's leading zeropackages/ui/src/components/Button/Button.tsxaria-labelfrom explicit label or string children; dev warning when missingpackages/ui/src/components/DataTable/DataTable.tsxsetSortDir(prev => ...))Notes & assumptions
1/03/2024,15/06/2024) — 4-digit year, day-first, no leading zero on day. Implemented to match that exactly rather thandateStyle: "short"(which would give a 2-digit year).formatDateTimewas left untouched.process.envwithtypeof process !== "undefined"since@e2e/uiships raw TS and a consumer bundler could otherwise throwReferenceError: process is not defined. The no-label fallback is""(not a bogus"Button") so a11y scanners still flag a genuinely unlabelled button.Known limitations (out of scope)
formatDateuses the ambient system timezone; tests useT12:00:00Z(±12h headroom), only break at UTC+13/+14. Pre-existing, not a regression.formatDatevsformatDateTimerender years inconsistently (4-digit vs 2-digit).aria-labelattribute is present rather than non-empty.