Skip to content

Commit 2873eea

Browse files
author
Andy Hanson
committed
Remove hardcoded port, use the custom port
1 parent c578367 commit 2873eea

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/webTestServer.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ function switchToForwardSlashes(path: string) {
2020
return path.replace(/\\/g, "/").replace(/\/\//g, '/');
2121
}
2222

23-
var defaultPort = 8888;
24-
var port = process.argv[2] || defaultPort;
23+
var port = parseInt(process.argv[2], 10) || 8888;
24+
if (port !== 8888) {
25+
throw new Error(`Port must be 8888. Got ${port}. See GH#9987`);
26+
}
2527
var rootDir = switchToForwardSlashes(__dirname + '/../');
2628

2729
var browser: string;
@@ -267,7 +269,7 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
267269
var reqPath = path.join(process.cwd(), uri);
268270
var operation = getRequestOperation(req, reqPath);
269271
handleRequestOperation(req, res, operation, reqPath);
270-
}).listen(8888);
272+
}).listen(port);
271273

272274
var browserPath: string;
273275
if ((browser && browser === 'chrome')) {

0 commit comments

Comments
 (0)