Listen on 0 to get random port
authorKevin Sawicki <kevin@github.com>
Mon, 5 May 2014 21:06:47 +0000 (14:06 -0700)
committerKevin Sawicki <kevin@github.com>
Mon, 5 May 2014 21:06:47 +0000 (14:06 -0700)
spec/api-crash-reporter-spec.coffee

index 2c06303..999b54c 100644 (file)
@@ -34,8 +34,8 @@ describe 'crash-reporter module', ->
         res.end()
         server.close()
         done()
-    port = Math.floor(Math.random() * 55535 + 10000)
-    server.listen port, '127.0.0.1', ->
+    server.listen 0, '127.0.0.1', ->
+      {port} = server.address()
       url = url.format
         protocol: 'file'
         pathname: path.join fixtures, 'api', 'crash.html'