after reset, don't bust cache for modules that weren't busted/replaced previously
まだ誰も着手していません。
評価
- 難易度
- 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分
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Design only Leadership Survey SLFS
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
bcgov/digital-journeys#2293 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tursodatabase/turso#9405 ·
メンテナーはふだん 1 日以内に返信
-
Toolkit
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
API Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ProjectSidewalk/SidewalkWebpage#5556 ·
メンテナーはふだん 1 日以内に返信