fix: make SQLite migrations and e2e reproducible

This commit is contained in:
2026-09-13 14:52:09 +03:00
parent 8637ad2f34
commit ce24a84b7f
10 changed files with 237 additions and 83 deletions
+15 -2
View File
@@ -1,4 +1,17 @@
process.env.DATABASE_URL ??= 'file:/tmp/wealth-ledger-e2e.db';
const { join, dirname, basename } = require('node:path');
const { tmpdir } = require('node:os');
const dir = process.env.WL_E2E_DIRECTORY;
if (
!dir ||
dirname(dir) !== tmpdir() ||
!basename(dir).startsWith('wealthledger-e2e-') ||
process.env.DATABASE_URL !== `file:${join(dir, 'test.db')}`
) {
throw new Error(
'Use npm run test:e2e or test:sqlite: an isolated runner database is required.',
);
}
process.env.FRONTEND_ORIGIN = 'http://localhost:5173';
process.env.JWT_SECRET = 'e2e-secret-that-is-at-least-thirty-two-characters';
process.env.TOKEN_ENCRYPTION_KEY = 'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=';
process.env.TOKEN_ENCRYPTION_KEY =
'MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=';