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

Assert package doesn't synthesize the stack

Aperta
#349 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, typescript

Direzione di ricerca

Inizia dalla sezione Fine-grained Assertions in doc_source/testing.md e riproduci l’esempio usando uno Stack personalizzato, spostando la creazione delle risorse all’interno dello stack come descritto. Confronta l’input del matcher con l’esempio SynthUtils.toCloudFormation(MyStack); il lavoro è completato quando la documentazione riflette chiaramente la configurazione di test reale e l’assertion segnala le risorse previste.

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

Descrizione

If you follow the documentation for Fine-grained Assertions - the test will pass.

It's not a real-world scenario though - you don't create a resource in a test, you create the resource in the stack definition.

If you modify the test and move new dlq.DeadLetterQueue(...) inside of the new Stack() call (assuming new Stack() is a custom stack like export class MyStack extends Stack { ... }, the test will fail and indicate that there are 0 resources.


You can fix this error by adding a line; const stackTemplate = SynthUtils.toCloudFormation(new MyStack()) and passing the stackTemplate variable to the expect(...) call instead of the stack variable.

I'm not sure if this is a bug with the jest matcher though, or whether this fix is the right approach and the documentation just isn't quite matching up to a real-world scenario?

Lingua principale
Perl
Stelle
360
Fork
231
Merge medio
3g 23h
PR unite (30g)
1

Preparare l'ambiente

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 awsdocs/aws-cdk-guide

Tutte le issue di awsdocs/aws-cdk-guide

Issue simili

Altre issue su Perl

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.