epicweb-dev / epicweb-dev/epic-stack

How to use a different `*.db` file during e2e tests?

Aperta
#1,061 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
5.5k
Fork
460
Merge medio
2h 43m
PR unite (30g)
1

Descrizione

Hi!

I think we should use a different SQLite database instance for e2e testing. That is to separate whatever state the local database has during development. Basically, each test run should start with a clean database (and likely even drop the db between test suites/cases as well) to ensure proper test isolation.

I've tried setting `DATABASE_URL` to `file:./data.db?` in here:

https://github.com/epicweb-dev/epic-stack/blob/97135fcd7899cab299b402f36804b0d169e87d9d/playwright.config.ts#L37-L40

> I've also tried `DATABASE_PATH: './prisma/test.db'` to no effect.

But that had no effect on the app under test; it still used `./prisma/data.db`. I might be doing something wrong here... Any hints would be appreciated!

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da playwright.config.ts intorno alle righe 37-40 e traccia come l'applicazione sotto test riceve DATABASE_URL o DATABASE_PATH. Confronta questa configurazione con i percorsi attuali prisma/data.db e con i percorsi proposti prisma/test.db. È completato quando le esecuzioni e2e usano un database SQLite separato e pulito, con lo stato dei test isolato tra le esecuzioni o le suite.

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

Valutazione

Stack tecnologico
playwright, sqlite, typescript
Ambito
databases, testing
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.