You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(core): late-bind hooks and onTestFinished to current file under isolate: false
Continues the #1376 family: under `isolate: false` a context-bound
`@rstest/core` API value-copied into a module shared across files goes stale.
The file-level hooks (`afterAll`/`beforeAll`/`afterEach`/`beforeEach`) were left
bound to the first file's runner, so a shared helper re-exporting a hook (e.g.
`export const beforeEach = beforeEach`) silently registered into the first
file's torn-down collector from the second file on. `onTestFinished`/
`onTestFailed` had the same staleness against the per-file test runner and threw
"can only be called inside a test".
Route the hooks through `currentRuntime()` (the per-file `RSTEST_RUNTIME`, like
`it`/`describe`), and `onTestFinished`/`onTestFailed` through a new per-file
`globalThis.RSTEST_RUNNER` resolved at call time. The remaining `rstest`/`rs`
utilities object is the one known, non-idiomatic residual (re-exporting the whole
namespace), deferred until a real repro surfaces.
Refs #1376.
0 commit comments