File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 1616 "deploy" : " gcloud app deploy" ,
1717 "start" : " node app.js" ,
1818 "unit-test" : " mocha test/ --timeout=60000 --exit" ,
19- "system-test" : " repo-tools test app" ,
20- "all-test" : " npm run unit-test && npm run system-test" ,
21- "test" : " repo-tools test run --cmd npm -- run all-test"
19+ "test" : " npm run unit-test"
2220 },
2321 "dependencies" : {
2422 "body-parser" : " ^1.18.3" ,
25- "express" : " ^4.16.4"
23+ "chai" : " ^4.2.0" ,
24+ "express" : " ^4.16.4" ,
25+ "wait-port" : " ^0.2.7"
2626 },
2727 "devDependencies" : {
28- "@google-cloud/nodejs-repo-tools" : " ^3.3.0" ,
2928 "mocha" : " ^7.0.0" ,
3029 "proxyquire" : " ^2.1.0" ,
3130 "sinon" : " ^9.0.0" ,
Original file line number Diff line number Diff line change 1+ const waitPort = require ( 'wait-port' ) ;
2+ const { expect} = require ( 'chai' ) ;
3+ const PORT = process . env . PORT || 8080 ;
4+ const childProcess = require ( 'child_process' ) ;
5+ const path = require ( 'path' ) ;
6+ const appPath = path . join ( __dirname , '../app.js' ) ;
7+
8+ describe ( 'server listening' , ( ) => {
9+ it ( 'should be listening' , async ( ) => {
10+ const child = childProcess . exec ( `node ${ appPath } ` ) ;
11+ const isOpen = await waitPort ( { port : PORT } ) ;
12+ expect ( isOpen ) . to . be . true ;
13+ process . kill ( child . pid , 'SIGTERM' ) ;
14+ } ) ;
15+ } ) ;
You can’t perform that action at this time.
0 commit comments