Repository navigation
Conversation
…h the per-file reset The require bridge and the resolution memo create their counter objects lazily, often during a worker's first file, and the reset deleted them as that file's globals while the resident modules kept counting into the deleted objects. They are now created through one declared list, RESIDENT_GLOBALS, which the reset keeps.
This branch has not been deployed
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
Under the hot runtime, the require bridge's counters and the resolution memo's stats now last for the worker's life instead of reading empty from its second file on.
Fixes #792
Why
bridge-client.mjs,bridge.mjsandhooks.mjscreate these objects lazily, often during a worker's first file. The per-file reset deleted them as that file's globals, while the resident modules kept counting into the deleted objects.Changes
src/native/resident-globals.mjsdeclares vitest-native's worker-lifetime globals in one list,RESIDENT_GLOBALS. The three modules create theirs through it, and the reset keeps exactly those keys. A resident-state audit can read the same list.Symbol.for("vitest-native.…")global outside the list. The asset-id map is the one exception: it is keyed by React Native's per-file asset registry, so it is per-file state.test:native:hot:resident-globals(two files on one hot worker, intest:native:hot:isolation).Notes
reset.mjsnext to fix(hot-runtime): keep a non-configurable global for the worker instead of failing every later file #774, so it merges after fix(hot-runtime): keep a non-configurable global for the worker instead of failing every later file #774.