after reset, don't bust cache for modules that weren't busted/replaced previously
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, nodejs
- 领域
- testing-qa
调研方向
Start by running npm run test in the attached jasmin-testdoubleBugExample.zip with Node 24.13.0 on Windows 11, then trace testdouble's ESM replacement and reset handling around the module cache. Done means a second jasmine.execute() does not reload untouched spec files after reset, while modules previously replaced through replaceEsm() still receive the intended cache treatment.
由索引模型根据 Issue 内容生成。
描述
Here is a zip file with a working demonstration of the problem (npm run test from inside the folder; node version 24.13.0; Windows 11)
jasmin-testdoubleBugExample.zip
My team uses infrastructure to connect loaded code to the chrome nodejs devtools, in order to enable us to debug our code more easily. It is very common for us to run our jasmine tests more than once in a session. That is what the sequential calls to running the tests are meant to simulate.
Sometimes our jasmine tests use testdouble to replace esm dependencies. Every time jasmine.execute() is called, it will use dynamic import to load all spec files, regardless of whether it has loaded it before, relying on the module cache to prevent re-running specs.
So, the first time, jasmine loads the tests and runs them just fine. During the tests, a module is mocked using td.replaceEsm(). At the end of the tests, td.reset() is called.
The second time, jasmine loads the files again using dynamic import, and testdouble causes the cache to be busted for the test files, despite the fact that, up until this point, testdouble has not been asked about loading the test files at all. This causes the spec file to be run again, and jasmine complains about duplicate specs (even if it didn't error, getting duplicate tests added would be aggravating).
While jasmine could help itself by not trying to reload files that it has already loaded (and I have put in an issue about that), there is also no reason for testdouble to be busting cache on those files, seeing as they are not part of the tree of anything imported while replaceEsm was active, and reset was called before further attempts to import these files occurred.
- 主要语言
- JavaScript
- 星标
- 1.4k
- 派生
- 140
- 平均合并
- 5 小时 55 分钟
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testdouble/testdouble.js 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
testdouble/testdouble.js#537 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
testdouble/testdouble.js#536 ·
-
难度 4/5 3-5 天 新手友好度 25/100
testdouble/testdouble.js#534 ·
-
难度 1/5 1 小时以内 新手友好度 45/100
testdouble/testdouble.js#533 ·
-
难度 4/5 3-5 天 新手友好度 32/100
testdouble/testdouble.js#532 · 1 条评论 ·
查看 testdouble/testdouble.js 的全部 Issue
相似的 Issue
-
automation models
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
needs:triage
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
enhancement status: needs triage
难度 2/5 1-3 小时 新手友好度 88/100
mastra-ai/mastra#25508 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
agentic-workflows
难度 1/5 1 小时以内 新手友好度 72/100
githubnext/gh-aw-cao#15017 ·
维护者通常 1 天内回复