mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 01:43:59 -05:00
Merge pull request #5360 from Microsoft/runTestsBrowserOnLinux
pick default chrome location based on platform
This commit is contained in:
@@ -5,6 +5,7 @@ import fs = require("fs");
|
||||
import path = require("path");
|
||||
import url = require("url");
|
||||
import child_process = require("child_process");
|
||||
import os = require('os');
|
||||
|
||||
/// Command line processing ///
|
||||
|
||||
@@ -263,7 +264,20 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
|
||||
|
||||
var browserPath: string;
|
||||
if ((browser && browser === 'chrome')) {
|
||||
var defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
|
||||
let defaultChromePath = "";
|
||||
switch (os.platform()) {
|
||||
case "win32":
|
||||
case "win64":
|
||||
defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
|
||||
break;
|
||||
case "linux":
|
||||
defaultChromePath = "/opt/google/chrome/chrome"
|
||||
break;
|
||||
default:
|
||||
console.log(`default Chrome location is unknown for platform '${os.platform()}'`);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fs.existsSync(defaultChromePath)) {
|
||||
browserPath = defaultChromePath;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user