File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,10 +4,8 @@ const http = require('http');
44let app ;
55let server ;
66
7- beforeAll ( ( ) => {
8- // require the app by starting the server module
9- app = require ( 'express' ) ( ) ;
10- // mount the actual server.js app by requiring and exporting express app
7+ beforeAll ( async ( ) => {
8+ // Ensure server is running before tests (npm test starts it)
119} ) ;
1210
1311describe ( 'basic endpoints' , ( ) => {
Original file line number Diff line number Diff line change 55 "scripts" : {
66 "start" : " node server.js" ,
77 "dev" : " node server.js" ,
8- "test" : " node server.js & wait-on tcp:8080 && jest --runInBand; kill $(lsof -t -i:8080)"
8+ "test" : " node server.js & wait-on tcp:8080 && jest --runInBand; kill $(lsof -t -i:8080) || true "
99 },
1010 "keywords" : [],
1111 "author" : " " ,
1818 },
1919 "devDependencies" : {
2020 "jest" : " ^29.7.0" ,
21- "supertest" : " ^7.0.0 " ,
21+ "supertest" : " ^7.1.4 " ,
2222 "wait-on" : " ^7.2.0" ,
2323 "lsof" : " ^0.1.0"
2424 }
You can’t perform that action at this time.
0 commit comments