From: Cheng Zhao Date: Thu, 24 Apr 2014 07:42:37 +0000 (+0800) Subject: spec: Use random port when creating http server. X-Git-Tag: v0.12.0~14 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=0b3b621f813632226923e100b45f034ac37d3b26;p=electron.git spec: Use random port when creating http server. --- diff --git a/spec/api-crash-reporter-spec.coffee b/spec/api-crash-reporter-spec.coffee index 3aad0972..372ada3b 100644 --- a/spec/api-crash-reporter-spec.coffee +++ b/spec/api-crash-reporter-spec.coffee @@ -1,6 +1,7 @@ assert = require 'assert' path = require 'path' http = require 'http' +url = require 'url' remote = require 'remote' formidable = require 'formidable' @@ -31,5 +32,10 @@ describe 'crash-reporter module', -> res.end() server.close() done() - server.listen 1127, '127.0.0.1', -> - w.loadUrl 'file://' + path.join(fixtures, 'api', 'crash.html') + port = Math.floor(Math.random() * 55535 + 10000) + server.listen port, '127.0.0.1', -> + url = url.format + protocol: 'file' + pathname: path.join fixtures, 'api', 'crash.html' + search: "?port=#{port}" + w.loadUrl url diff --git a/spec/fixtures/api/crash.html b/spec/fixtures/api/crash.html index cb6c4358..db1518b8 100644 --- a/spec/fixtures/api/crash.html +++ b/spec/fixtures/api/crash.html @@ -1,11 +1,12 @@