mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 00:57:58 +00:00
* fix(webui): strip styles and preserve multiline text on paste in chat input * fix(db): remove custom log wait strategy in test global setup to prevent postgres startup race condition
35 lines
947 B
TypeScript
35 lines
947 B
TypeScript
import { PostgreSqlContainer } from '@testcontainers/postgresql'
|
|
import { exec } from 'node:child_process'
|
|
import { promisify } from 'node:util'
|
|
|
|
const execAsync = promisify(exec)
|
|
|
|
let dbContainer: import('@testcontainers/postgresql').StartedPostgreSqlContainer
|
|
|
|
export async function globalTestSetup() {
|
|
console.log('Starting Testcontainers for global setup...')
|
|
dbContainer = await new PostgreSqlContainer('pgvector/pgvector:pg18').start()
|
|
|
|
const databaseUrl = dbContainer.getConnectionUri()
|
|
console.log('Database started at:', databaseUrl)
|
|
|
|
process.env.DATABASE_URL = databaseUrl
|
|
|
|
console.log('Applying Prisma Migrations...')
|
|
await execAsync('bun run prisma migrate deploy', {
|
|
env: {
|
|
...process.env,
|
|
DATABASE_URL: databaseUrl,
|
|
},
|
|
})
|
|
console.log('Prisma Migrations completed.')
|
|
}
|
|
|
|
export async function setup() {
|
|
await globalTestSetup()
|
|
}
|
|
|
|
export async function teardown() {
|
|
await dbContainer?.stop()
|
|
}
|