File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 1+ import { spawn } from "child_process" ;
12import request from "supertest" ;
23import app from "#app" ; // Update this import based on your app"s structure
34import connector from "#models/databaseUtil" ; // Update this import
45
56const server = app . listen ( null , ( ) => {
6- connector . set ( "debug" , false ) ;
7+ connector . set ( "debug" , false ) ;
78} ) ;
89const agent = request . agent ( server ) ;
10+
11+ const child = spawn ( "node" , [ "./misc/initDB" ] ) ;
12+ child . stdout . on ( "data" , ( data ) => {
13+ console . log ( `stdout: ${ data } ` ) ;
14+ } ) ;
15+ child . stderr . on ( "data" , ( data ) => {
16+ console . log ( `stderr: ${ data } ` ) ;
17+ } ) ;
18+ child . stdout . on ( "error" , ( error ) => {
19+ console . log ( `error: ${ error . message } ` ) ;
20+ } ) ;
21+ child . on ( "exit" , ( code , signal ) => {
22+ if ( code ) console . log ( `Process exit with code: ${ code } ` ) ;
23+ if ( signal ) console . log ( `Process killed with signal: ${ signal } ` ) ;
24+ } ) ;
925global . server = server ;
1026global . agent = agent ;
1127export default async ( ) => {
12- global . server = server ;
13- global . agent = agent ;
14- } ;
28+ global . server = server ;
29+ global . agent = agent ;
30+ } ;
You can’t perform that action at this time.
0 commit comments