From 62cf6536a2d36dc39864c302bab78e16769a55ff Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Sat, 11 Jul 2015 11:24:50 +0200 Subject: [PATCH] Tests: Resolve -b to full path in webbrowser.js This allows us to simply use "node test.js -b=firefox" instead of having to type out the full path. --- test/webbrowser.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/webbrowser.js b/test/webbrowser.js index 3795e4482..0cc8da787 100644 --- a/test/webbrowser.js +++ b/test/webbrowser.js @@ -157,17 +157,18 @@ ChromiumBrowser.prototype.buildArguments = function (url) { WebBrowser.create = function (desc) { var name = desc.name; - - // Throws an exception if the path doesn't exist. - fs.statSync(desc.path); + var path = shelljs.which(desc.path); + if (!path) { + throw new Error('Browser executable not found: ' + desc.path); + } if (/firefox/i.test(name)) { - return new FirefoxBrowser(desc.name, desc.path); + return new FirefoxBrowser(name, path); } if (/(chrome|chromium|opera)/i.test(name)) { - return new ChromiumBrowser(desc.name, desc.path); + return new ChromiumBrowser(name, path); } - return new WebBrowser(desc.name, desc.path); + return new WebBrowser(name, path); };