expect().toThrow(): support checking properties
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- testing
Direzione di ricerca
Inizia individuando l’implementazione di expect().toThrow() e i test del relativo matcher. Confronta i controlli richiesti sulle proprietà di Error e le alternative con callback o errore restituito, quindi definisci un comportamento supportato con test che coprano la corrispondenza del messaggio e il controllo di proprietà come cause.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
I can check that something will throw but I don't see a straightforward way to check properties on the thrown exception.
Describe the solution you'd like
expect(someFn).toThrow(new Error("kaboom", { cause: new TypeError("bad input") }));
or some way to pass in a function to toThrow() or to get the thrown exception to check things:
expect(someFn).toThrow(new Error("kaboom"), (e) => {
// more assertions, e.g. on `e.cause`
});
const thrownError = expect(someFn).toThrow(new Error("kaboom"));
// more assertions, e.g. on `thrownError.cause`
Describe alternatives you've considered
- Calling the function direclty myself and wrapping with
try...catch(I have to remember to add an explicitfail()if the function doesn't throw, otherwise the test may pass with a false positive). - Using some setup with a spy to catch the exception… not sure if that is a thing yet or not.
- Lingua principale
- TypeScript
- Stelle
- 3.6k
- Fork
- 713
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di denoland/std
-
`assertEquals` throws on structurally equal `Error` objects due to different stack traceForse già presa @powerman2026 l’ha presa 1 giorno fa. Apertabug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
streams: DelimiterStream leaves delimiter bytes in the output when the delimiter spans more than two chunksForse già presa @helmipradita l’ha presa 15 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
@std/encoding: decodeAscii85 corrupts delimited data ending in "<", decodeVarint32 reads past the end of the bufferForse già presa @helmipradita l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
@std/yaml: stringify() with condenseFlow wraps already quoted keys in a second pair of quotesForse già presa @sebxt l’ha presa 35 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
@std/ini parse silently drops an entire section when the section name repeatsForse già presa @Harsh23Kashyap l’ha presa 35 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di denoland/std
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
vercel-labs/ui#1066 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ranxianglei/billion-context#7597 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation target:powerpoint
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
tomast1337/PdfLapas#602 ·
I maintainer di solito rispondono entro 1 giorno
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runForse già presa @kc9ddi l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TeraSky-OSS/backstage-plugins#228 ·