Skip to content
Snippets Groups Projects
Commit 425084b5 authored by syuilo's avatar syuilo
Browse files

Update utils.ts

parent 2205c61e
No related branches found
No related tags found
No related merge requests found
......@@ -159,7 +159,7 @@ export function launchServer(callbackSpawnedProcess: (p: childProcess.ChildProce
export async function initTestDb(justBorrow = false, initEntities?: any[]) {
if (process.env.NODE_ENV !== 'test') throw 'NODE_ENV is not a test';
return new DataSource({
const db = new DataSource({
type: 'postgres',
host: config.db.host,
port: config.db.port,
......@@ -170,6 +170,10 @@ export async function initTestDb(justBorrow = false, initEntities?: any[]) {
dropSchema: true && !justBorrow,
entities: initEntities || entities,
});
await db.initialize();
return db;
}
export function startServer(timeout = 30 * 1000): Promise<childProcess.ChildProcess> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment