(aws-cdk): use either vitest or Node.js Test Runner for testing instead of jest

Aperta
#936 7 commenti 10 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
node.js, typescript
Ambito
cli, testing-qa

Direzione di ricerca

Individua il template di app TypeScript prodotto da cdk init app e ispeziona prima il package.json generato e la configurazione dei test. Scegli tra Vitest e Node.js Test Runner, quindi verifica che un progetto generato non richieda più Jest, ts-jest o @types/jest e che i suoi test unitari vengano eseguiti correttamente.

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

Descrizione

aws-cdk feature-request p2
Describe the feature

I followed Tutorial: Create your first AWS CDK app and ran the following command

$ hello-cdk> cdk --version
2.1031.2 (build 779352d)

$ hello-cdk> cdk init app --language typescript
...

It uses jest by default which requires additional dependency ts-jest for setup, as well as explicit installation of @types/jest

$ grep jest package.json 
    "test": "jest",
    "@types/jest": "^29.5.14",
    "jest": "^29.7.0",
    "ts-jest": "^29.2.5",
Use Case

Over the years, the vitest seems to be becoming popular test framework.

There are several comparisons online, and npm trends shows vitest growing faster than jest.

If cdk init project uses vitest, the CDK customers will benefit from improved performance. Vitest has first-class support for TypeScript, so the types and additional dependencies are not required to be installed.

Even better, the CDK project can just use Node.js test runner instead. It should have enough features which CDK customers might need for their test setup.

Proposed Solution

Use vitest or Node.js Test Runner instead of jest for unit testing.

Other Information
npm trends jest vs vitest Image
Acknowledgements
  • I may be able to implement this feature request
  • This feature might incur a breaking change
CDK version used

2.1031.2

Environment details (OS name and version, etc.)

All

Lingua principale
TypeScript
Stelle
110
Fork
138
Merge medio
1g 9h
PR unite (30g)
55

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 aws/aws-cdk-cli

Tutte le issue di aws/aws-cdk-cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.