test(web): run isolated web suite directly#1848
Merged
Merged
Conversation
0d25fba to
fa28e11
Compare
- Override getBoundingClientRect on BOTH HTMLElement.prototype and window.HTMLElement.prototype since JSDOM may use a different HTMLElement internally than globalThis - Use hardcoded test rects based on testid for consistent values - Remove intermediate ref callbacks, use hook refs directly - Move ResizeObserver mock setup to beforeEach for consistent timing - Replace waitFor with direct assertions after explicit timeout - Reset motion state in beforeEach/afterEach The tests were failing in CI because: 1. JSDOM creates its own HTMLElement class assigned to window.HTMLElement 2. Elements created by JSDOM use window.HTMLElement.prototype 3. Only overriding globalThis.HTMLElement.prototype wasn't sufficient 4. Must override both prototypes to ensure the mock is used Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49063c2 to
1d35337
Compare
Use the canonical test pattern with renderHook and mock elements rather than rendering full components with prototype-level getBoundingClientRect overrides. This approach is consistent with useCalendarGridLayout tests and avoids CI-specific prototype override issues. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1d35337 to
b24b3fa
Compare
The useGridLayout hook is a thin wrapper around useCalendarGridLayout that passes DAYS_IN_VIEW=7 and isWeekInteractionMotionActive. All functionality is already covered by useCalendarGridLayout.test.tsx which tests the same 7-day layout measurements. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The createPlannerSidebar refactor imported the fixed-position shortcut hint overlay instead of the sidebar modal, which blocked sidebar clicks in e2e tests and ignored isShortcutsOpen. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Reduces web unit test runs from ~4min to under 1 minute.
This replaces the interim batched web test runner with the intended endpoint:
bun run test:webnow runsbun test --cwd packages/webdirectly, and the shared test dispatcher no longer walks or chunks web test files.The branch keeps the previous batching commit as history, but the latest commit removes that workaround and fixes the underlying isolation leaks that forced batching/process boundaries in the first place.
What changed
packages/scripts/src/testing/run.ts.package.jsonsotest:webis a direct Bun test command.render-with-storefor web tests that should use real Redux providers instead of mocking store hooks.mock.moduleusage for shared modules and UI primitives.:has(...)styled-components rule without deleting unrelated styles.Why the interim batching approach was a smell
Batching made the suite faster than one-file-per-process execution, but it still encoded test isolation into
packages/scripts/src/testing/run.tsinstead of into the tests themselves. That meant:WEB_TEST_BATCH_SIZEbecame a hidden compatibility contract;mock.moduleleaks still depended on file order and process boundaries;bun test --cwd packages/web, still could not be trusted.The real fix is to keep tests independent enough that Bun can run the package suite in one direct invocation.
Follow-up plan
The suite now meets the desired endpoint, but the remaining test hygiene work should continue in normal feature work:
renderWithStoreover mocking Redux hooks or@web/store.mock.modulefor shared UI primitives, session hooks, and utility modules.bun test --cwd packages/webas the acceptance check for web isolation, not just focused file runs.Verification
bun test --cwd packages/webpasses: 1029 tests.bun run test:webpasses: 1029 tests.bun run type-check:web-testspasses.bun run type-checkpasses.bun lintpasses.bun run test:scriptspasses: 57 tests.