File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 "node" : " >=8.0.0"
1414 },
1515 "scripts" : {
16- "unit-test" : " mocha test/* .test.js --timeout=60000" ,
16+ "unit-test" : " mocha test/createTables .test.js --timeout=60000 && mocha test/server.test.js " ,
1717 "start-proxy" : " ! pgrep cloud_sql_proxy > /dev/null && cloud_sql_proxy -instances=$INSTANCE_CONNECTION_NAME=tcp:$SQL_PORT &" ,
18- "system-test" : " repo-tools test app -- server.js " ,
18+ "system-test" : " mocha test/serverListening.test.js --exit " ,
1919 "system-test-proxy" : " npm run start-proxy; npm run system-test" ,
2020 "all-test" : " npm run unit-test && npm run system-test" ,
2121 "test" : " npm -- run all-test"
2222 },
2323 "dependencies" : {
24+ "chai" : " ^4.2.0" ,
2425 "express" : " ^4.16.4" ,
2526 "knex" : " ^0.20.0" ,
2627 "mysql" : " ^2.16.0" ,
2728 "prompt" : " ^1.0.0"
2829 },
2930 "devDependencies" : {
30- "@google-cloud/nodejs-repo-tools" : " ^3.3.0" ,
3131 "mocha" : " ^7.0.0" ,
3232 "proxyquire" : " ^2.1.0" ,
3333 "sinon" : " ^9.0.0" ,
34- "supertest" : " ^4.0.0"
34+ "supertest" : " ^4.0.0" ,
35+ "wait-port" : " ^0.2.7"
3536 },
3637 "cloud-repo-tools" : {
3738 "requiresKeyFile" : true ,
Original file line number Diff line number Diff line change 1+ const waitPort = require ( 'wait-port' ) ;
2+ const { expect} = require ( 'chai' ) ;
3+
4+ describe ( 'server listening' , ( ) => {
5+ it ( 'should be listening' , async ( ) => {
6+ require ( '../server.js' ) ;
7+ const isOpen = await waitPort ( { port : 8080 } ) ;
8+ expect ( isOpen ) . to . be . true ;
9+ } ) ;
10+ } ) ;
You can’t perform that action at this time.
0 commit comments