epicweb-dev / epicweb-dev/epic-stack

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

オープン
#1,061 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
5.5k
フォーク
461
平均マージ
2時間 43分
マージ済み PR(30日)
1

説明

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!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

playwright.config.ts の37〜40行目付近から始め、テスト対象のアプリが DATABASE_URL または DATABASE_PATH をどのように受け取るかを追跡します。その設定を、現在のパス prisma/data.db および提案されているパス prisma/test.db と比較します。e2e の実行で分離されたクリーンな SQLite データベースが使用され、実行間またはスイート間でテスト状態が分離されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
playwright, sqlite, typescript
領域
databases, testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。