fix: make SQLite migrations and e2e reproducible
This commit is contained in:
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user