Repository navigation
test: simplify fake timer handling in will-display tests - #1538
Merged
Merged
Conversation
Fake only setTimeout/clearTimeout as TESTS.md requires for IndexedDB tests, restore timers in afterEach instead of try/finally, and make flush() use setImmediate so it works while setTimeout is faked. The never-responds test now steps exactly T-1 and +1 with no extra advance. Also note in AGENTS.md that tests should not use try/catch or try/finally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sherwinski
reviewed
Oct 28, 2026
sherwinski
approved these changes
Oct 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Description
1 Line Summary
Simplify fake timer handling in the will-display service worker tests and add a no try/catch rule for tests to AGENTS.md.
Details
Follow-up to #1537. The two will-display tests faked every timer and used
try/finally, plus a+10advance to let the notification show.setTimeout/clearTimeout, asTESTS.mdrequires for tests that touch IndexedDB.afterEachinstead oftry/finally.flush()now usessetImmediateinstead ofsetTimeout(0), so it also works whilesetTimeoutis faked.T - 1(not shown) and+1(shown), with aflush()after each. The+10only gave queued async work more rounds and did not represent real time.try/catchortry/finally.Test-only change, no SDK behavior changes.
Systems Affected
Validation
Tests
Info
vp test run: 64 files, 612 tests pass.ServiceWorker.test.tspassed 3 runs in a row.vp check: no errors, no new warnings.Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
Not needed, test-only change.
Checklist
Related Tickets
Follow-up to #1537
🤖 Generated with Claude Code