File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const MKCERT_VERSION = "v1.3.0"
88
99// get the executable name
1010function getExe ( ) {
11+ /* istanbul ignore next: tested on all platform on travis */
1112 switch ( process . platform ) {
1213 case "darwin" :
1314 return "mkcert-" + MKCERT_VERSION + "-darwin-amd64"
@@ -45,8 +46,9 @@ function mkcert(path, exe) {
4546 "-key-file " + path + "localhost.key localhost" , ( err , stdout , stderr ) => {
4647 console . log ( stdout )
4748 console . error ( stderr )
49+ /* istanbul ignore if: cannot be tested */
4850 if ( err ) reject ( err )
49- else resolve ( )
51+ resolve ( )
5052 } )
5153 } )
5254}
@@ -66,6 +68,7 @@ async function main() {
6668}
6769
6870// run as script
71+ /* istanbul ignore if: cannot be tested */
6972if ( require . main === module )
7073 try { main ( ) } catch ( err ) { console . error ( "\nExec error: " + err ) }
7174
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const http = require("http")
44const https = require ( "https" )
55
66const app = require ( "../index.js" )
7+ const install = require ( "../cert/generate.js" )
78
89const HTTPS_PORT = 4443
910const HTTP_PORT = 8080
@@ -120,3 +121,15 @@ describe("Testing https-localhost", () => {
120121 . then ( res => assert ( res . headers [ "content-encoding" ] === "gzip" ) )
121122 } )
122123} )
124+
125+ // TESTS
126+ describe ( "Testing the installation script" , function ( ) {
127+ // timeout 5 min
128+ this . timeout ( 300000 )
129+
130+ it ( "installs correctly" , async function ( ) {
131+ await install ( )
132+ assert ( fs . existsSync ( "cert/localhost.crt" ) )
133+ assert ( fs . existsSync ( "cert/localhost.key" ) )
134+ } )
135+ } )
You can’t perform that action at this time.
0 commit comments