Skip to content

proxy globals to isolate them between tests - #83

Draft
ianmacartney wants to merge 4 commits into
mainfrom
ian/save-restore-globals
Draft

proxy globals to isolate them between tests#83
ianmacartney wants to merge 4 commits into
mainfrom
ian/save-restore-globals

Conversation

@ianmacartney

@ianmacartney ianmacartney commented Apr 2, 2026

Copy link
Copy Markdown
Member

Proxy globals to isolate them between tests

Added global proxy system using AsyncLocalStorage to isolate global variable modifications between test contexts. When user code patches globals like setTimeout, fetch, Date, etc., the changes are scoped to the current handler execution and don't leak to nested Convex calls or parallel executions.

The proxy intercepts reads/writes to a predefined list of patchable globals, storing overrides in per-context storage while falling back to original values when no override exists.

Added comprehensive test coverage for global isolation scenarios including nested queries/mutations, parallel actions, and inline handlers.

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianmacartney
ianmacartney force-pushed the ian/save-restore-globals branch 2 times, most recently from d621f26 to 43330af Compare April 29, 2026 22:10
@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/convex-test@83

commit: 0ffb731

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant