File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,4 +2,4 @@ language: node_js
22node_js :
33- " stable"
44sudo : required
5- script : " sudo $(which npm) test "
5+ script : " sudo node_modules/mocha/bin/mocha --exit "
Original file line number Diff line number Diff line change 55 "main" : " index.js" ,
66 "scripts" : {
77 "start" : " node index.js" ,
8- "test" : " TEST=true mocha --exit"
8+ "test" : " mocha --exit"
99 },
1010 "bin" : {
1111 "serve" : " ./index.js"
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ const http = require('http')
55const https = require ( 'https' )
66const app = require ( '../index.js' )
77
8+ process . env . TEST = true
9+
810// run an external script located in the scriptPath
911function runScript ( scriptPath , args = [ ] , background = false ) {
1012 return new Promise ( ( resolve , reject ) => {
@@ -52,7 +54,7 @@ function makeRequest(path = "/", secure = false) {
5254 } )
5355}
5456
55- let process
57+ let proc
5658
5759// TESTS
5860describe ( "Testing https-localhost" , ( ) => {
@@ -68,11 +70,11 @@ describe("Testing https-localhost", () => {
6870 it ( 'serve static file used as standalone tool' , async function ( ) {
6971 await app . close ( )
7072 runScript ( "index.js" , [ "test" ] , true )
71- . then ( proc => process = proc )
73+ . then ( process => proc = process )
7274 . catch ( err => console . error ( err ) )
7375 await sleep ( 500 )
7476 await makeRequest ( "/test.html" , true )
7577 . then ( res => assert ( res . data . toString ( ) === fs . readFileSync ( "test/test.html" ) . toString ( ) ) )
76- if ( process ) process . kill ( 'SIGINT' )
78+ if ( proc ) proc . kill ( 'SIGINT' )
7779 } )
7880} )
You can’t perform that action at this time.
0 commit comments