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
-18
View File
@@ -2,7 +2,6 @@ import { INestApplication } from '@nestjs/common';
import { JwtService } from '@nestjs/jwt';
import { Test } from '@nestjs/testing';
import assert from 'node:assert/strict';
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import type { Server } from 'node:http';
import request from 'supertest';
@@ -83,23 +82,6 @@ describe('Manual bank cards configured HTTP and real SQLite', () => {
db = app.get(PrismaService);
};
beforeAll(async () => {
const url = process.env.DATABASE_URL;
if (
!url ||
!/^file:\/(?:private\/)?tmp\/bank-cards-[^/]+\/.+\.db$/.test(url)
)
throw new Error(
'Pass a unique /tmp/bank-cards-*/test.db DATABASE_URL. No shared/user database is allowed.',
);
execFileSync(
process.execPath,
['node_modules/prisma/build/index.js', 'migrate', 'deploy'],
{
cwd: process.cwd(),
env: { ...process.env, RUST_LOG: 'info' },
stdio: 'pipe',
},
);
await start();
await db.user.createMany({
data: [