test: add regression coverage for error handlers and attachmentLimits - #2856
Draft
cursor[bot] wants to merge 2 commits into
Draft
test: add regression coverage for error handlers and attachmentLimits#2856cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
New-tab and history share the same ErrorEvent/unhandledrejection handler logic as onboarding (#2714) but lacked integration coverage for cross-origin script errors, empty ErrorEvents, non-Error throws, and primitive rejection reasons. Add matching tests to prevent regressions in telemetry reporting.
Add integration tests for config-driven image limits (mirroring the existing file-cap test from #2816) and verify malformed partial attachmentLimits objects degrade to hook defaults instead of crashing the omnibar.
Contributor
[Beta] Generated file diffTime updated: Mon, 13 Jul 2026 08:06:36 GMT IntegrationFile has changed |
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.
Asana Task/Github Issue: Weekly test coverage automation
Description
Adds missing integration tests for recently merged production logic where coverage was weak:
Global error listeners (new-tab + history) — Onboarding already had edge-case tests for the shared
ErrorEvent/unhandledrejectionhandlers (Fall back to ErrorEvent.message in special-pages error handlers #2714), but new-tab and history only covered the happy path. Added parity tests for cross-origin script errors (ErrorEvent.messagefallback), empty ErrorEvents, non-Error throws, and primitive/nullish rejection reasons.NTP attachmentLimits (NTP: Use attachmentLimits config for NTP omnibar attachments #2816) — File cap and oversize rejection were covered, but config-driven image caps and partial/malformed
attachmentLimitspayloads were not. Added integration tests verifyingimageMaxPerTurnconfig, and that empty{ files: {}, images: {} }sections degrade to hook defaults (3) without crashing.Risky behavior now covered
attachmentLimitspayloads from native/backend do not throw at optional-chaining sitesTest files added/updated
special-pages/pages/new-tab/integration-tests/new-tab.spec.jsspecial-pages/pages/history/integration-tests/history.spec.jsspecial-pages/pages/new-tab/app/omnibar/integration-tests/omnibar-attachments.spec.jsspecial-pages/pages/new-tab/app/omnibar/mocks/omnibar.mock-transport.js(test fixture only)Why these tests materially reduce regression risk
The error-handler tests protect telemetry quality across three high-traffic special pages that share identical handler logic — a fix or refactor on one page could silently diverge on others. The attachmentLimits tests guard a new config-driven code path (#2816) where incorrect optional chaining or limit wiring would either crash the omnibar or allow oversized/beyond-cap attachments through to Duck.ai.
Testing Steps
cd special-pages && npm run test-int -- pages/new-tab/integration-tests/new-tab.spec.js --grep "global error listeners" --reporter listcd special-pages && npm run test-int -- pages/history/integration-tests/history.spec.js --grep "global error listeners" --reporter listcd special-pages && npm run test-int -- pages/new-tab/app/omnibar/integration-tests/omnibar-attachments.spec.js --grep "attachmentLimits|image attachment limits|partial attachmentLimits" --reporter listChecklist