Commit ff82b29
committed
Fix test tasks connecting to production DB
mise.toml's `_.file = ".env"` loads the production DATABASE_URL into
the process environment before any task runs. Deno's --env-file flag
does not override variables already present in the environment, so
both `deno task test` and `mise run migrate:test` were silently
connecting to the production database instead of the test database.
This caused local tests to see real production data (e.g. posts from
November 2025) and migrate:test to apply migrations against production
rather than hackerspub_test. CI was also affected when DATABASE_URL
was already set in the environment.
Fix by using godotenv (github:joho/godotenv) with the -o (override)
flag, which forcibly overwrites any pre-existing environment variable
with the value from .env.test regardless of how it was set.
Assisted-by: Claude Code:claude-sonnet-4-61 parent c3f5ef8 commit ff82b29
2 files changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
0 commit comments