Skip to content

Commit 0834a29

Browse files
committed
pick default chrome location based on platform
1 parent 9afc2b3 commit 0834a29

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/webTestServer.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import fs = require("fs");
55
import path = require("path");
66
import url = require("url");
77
import child_process = require("child_process");
8+
import os = require('os');
89

910
/// Command line processing ///
1011

@@ -263,7 +264,20 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
263264

264265
var browserPath: string;
265266
if ((browser && browser === 'chrome')) {
266-
var defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
267+
let defaultChromePath = "";
268+
switch (os.platform()) {
269+
case "win32":
270+
case "win64":
271+
defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
272+
break;
273+
case "linux":
274+
defaultChromePath = "/opt/google/chrome/chrome"
275+
break;
276+
default:
277+
console.log(`default Chrome location is unknown for platform '${os.platform()}'`);
278+
break;
279+
}
280+
267281
if (fs.existsSync(defaultChromePath)) {
268282
browserPath = defaultChromePath;
269283
} else {

0 commit comments

Comments
 (0)