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

Multiple stubbings with throwException causes unexpected behavior

Chiusa
#537 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start by reproducing the two-stubbing example in the issue and review the related issue #180. Trace how matching stubbings are selected when the first uses thenThrow and the second uses thenReturn. Done means the observed behavior is resolved or a verified workaround is documented.

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

Descrizione

When you set two stubbings that match the same invocation with the first stubbing calling throwException declaring the second stubbing trigger the exception of the first stubbing.

Example :

td.when(dep()).thenThrow(new Error())
td.when(dep()).thenReturn(true)

Executing the above code will throw an error of type Error.

I think it relates to this issue. Not sure if it can be fixed in testdouble but is there at least a workaround ?

Lingua principale
JavaScript
Stelle
1.4k
Fork
141
Merge medio
2h 30m
PR unite (30g)
10

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.