Repository navigation
Conversation
…xpect matchers RNTL and Vitest's expect are resident, so an RNTL configure() call or an expect.extend matcher in one file stayed in effect for every later file on the worker. Two state-manifest entries now reset them at each file boundary, as a fresh load does under Jest and per-file isolation. vitest.worker-state joins the published entry list.
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
hotRuntime, an RNTLconfigure()call or anexpect.extendmatcher in one test file no longer reaches later files on the same worker.Fixes #807
Fixes #808
Why
RNTL and Vitest's
expectare loaded once per hot worker. A file could therefore pass only because an earlier file on its worker had configured RNTL or registered a matcher. Under Jest and per-file isolation, each file gets its own.Changes
rntl.config: at each file boundary, every loaded copy of RNTL's config module is reset to its defaults. Setup files run afterwards and configure it again.vitest.expect-matchers(src/native/expect-matchers.mjs): matchers and equality testers go back to their state after the first file's setup files. That coversexpectandexpect.not, chai'sAssertion.prototype, Jest's matchers object, the asymmetric matchers object and the equality-tester list.vitest.worker-statejoinsHOT_STATE_MANIFEST_ENTRIES, so doctor lists it. The mutation gate skips it, since it restores nothing. A unit test now holds the list to every entrysrcregisters.21-rntl-config,22-expect-matchers) assert that each file starts clean, then leave their change behind for the next file.tests/errors.test.tsmatches its exemptions against the package-relative path. A checkout whose path containedmatchers/skipped every file.Notes