fix mock type isolation between test files#10758
Conversation
|
Hello @Minghan2005. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
1 similar comment
|
Hello @Minghan2005. Your PR has been labeled To keep your PR open, please follow these steps:
Please, do not generate or format the response with AI. If you do not speak English, reply in your native language or use translation software like Google Translate or Deepl. If the response is generated, the PR will be closed automatically. These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context. |
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Yes, I am a real human being. I have read and understand the context, and I read the full issues and commets I will follow the rules, I will respond to them, and I am willing to give feedback. My AI tool is Codex.I am a fresh man, if you have any problems, please tell me |
|
Could you pass it |
bf664a2 to
d66a5f4
Compare
|
CI follow-up: the current head (
The originally failing Windows E2E scenario also passed on the next run. I cannot rerun individual upstream Actions jobs because GitHub requires repository admin permission. Could a maintainer please rerun these three failed jobs? |
Fixes #10290.
When
isolate: falsereuses a module runner, an evaluated module can retain themockedModulestored in its metadata from an earlier test file. A later file may register a different mock type for the same module, but the runner previously used the cached metadata as long as any active mock existed. This allowed the earlier manual factory to leak into a later automock.This change resolves the active mock from the current test file's registry before dispatching. Cached metadata is still used to detect redirect self-imports, while removed mocks continue to fall back to the original module.
The regression test runs two ordered files in one non-isolated worker: the first registers a manual factory and the second registers an automock for the same module.
Checks:
CI=true pnpm test test/mock-isolation.test.ts --runintest/e2ethreadsandforksprojects (26 tests)pnpm lint:fixpnpm typecheck