Skip to content

fix(hot-runtime): each file starts from RNTL's defaults and its own expect matchers - #811

Draft
danfry1 wants to merge 1 commit into
mainfrom
fix/hot-rntl-config-expect-matchers
Draft

danfry1 wants to merge 1 commit into
mainfrom
fix/hot-rntl-config-expect-matchers

Conversation

@danfry1

@danfry1 danfry1 commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Summary

Under hotRuntime, an RNTL configure() call or an expect.extend matcher in one test file no longer reaches later files on the same worker.

Fixes #807
Fixes #808

Why

RNTL and Vitest's expect are 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

  • New state-manifest entry 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.
  • New entry 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 covers expect and expect.not, chai's Assertion.prototype, Jest's matchers object, the asymmetric matchers object and the equality-tester list.
  • vitest.worker-state joins HOT_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 entry src registers.
  • New cross-file pairs in the hot isolation suite (21-rntl-config, 22-expect-matchers) assert that each file starts clean, then leave their change behind for the next file.
  • tests/errors.test.ts matches its exemptions against the package-relative path. A checkout whose path contained matchers/ skipped every file.

Notes

…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.
@danfry1 danfry1 added this to the 0.16.0 milestone Nov 14, 2026
@danfry1 danfry1 added bug Something isn't working area:hot-runtime hotRuntime: worker reuse, per-file reset, memory plan labels Nov 14, 2026

This branch has not been deployed

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

Labels

area:hot-runtime hotRuntime: worker reuse, per-file reset, memory plan bug Something isn't working

Projects

None yet

1 participant