test(browser): stop the unit suite losing its page mid-run - #1596
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates browser test execution to reduce memory usage and improves Client.from unit tests by avoiding module-level transport mocks.
Changes:
- Refactor
contract.Client.fromtests to inject a realrpc.Serverand spy onserver.httpClient.post. - Add assertions around RPC call behavior in
Client.fromtests. - Disable Vitest browser isolation to reuse a single iframe across test files and avoid repeated module graph evaluation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| test/unit/contract/client_from.test.ts | Replaces module mocking with injected Server + httpClient.post spy and adds RPC-call assertions. |
| config/vitest.config.browser.ts | Disables test isolation in browser mode to reduce memory growth and improve runtime. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ryang-21
approved these changes
Aug 6, 2026
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.
src/xdrgraph in its own iframe until Firefox lost the page partway throughvi.mockinclient_from.test.tswith aServerinjected viaoptions.server— sharing one iframe means a module mock leaks into every file that runs after itrestoreMocksandunstubGlobalson every vitest config as a backstop, sincetest/unitruns under both the node and the browser runnervi.spyOnfalls through to the real transport once queued responses run out where the previous barevi.fnreturnedundefinedtoHaveBeenCalledTimesassertions to bothClient.fromtests, enforcing the SAC case's documented "no second ledger-entries call" claim