Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

after reset, don't bust cache for modules that weren't busted/replaced previously

Aperta
#538 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, nodejs
Ambito
testing-qa

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
1.4k
Fork
140
Merge medio
5h 55m
PR unite (30g)
4

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di testdouble/testdouble.js

Tutte le issue di testdouble/testdouble.js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.