Browse Source

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.
Rob Wu 10 years ago
parent
commit
62cf6536a2
  1. 13
      test/webbrowser.js

13
test/webbrowser.js

@ -157,17 +157,18 @@ ChromiumBrowser.prototype.buildArguments = function (url) {
WebBrowser.create = function (desc) { WebBrowser.create = function (desc) {
var name = desc.name; var name = desc.name;
var path = shelljs.which(desc.path);
// Throws an exception if the path doesn't exist. if (!path) {
fs.statSync(desc.path); throw new Error('Browser executable not found: ' + desc.path);
}
if (/firefox/i.test(name)) { if (/firefox/i.test(name)) {
return new FirefoxBrowser(desc.name, desc.path); return new FirefoxBrowser(name, path);
} }
if (/(chrome|chromium|opera)/i.test(name)) { 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);
}; };

Loading…
Cancel
Save