[Pkg-javascript-commits] [pdf.js] 82/157: Tests: Resolve -b to full path in webbrowser.js

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 62cf6536a2d36dc39864c302bab78e16769a55ff
Author: Rob Wu <rob at robwu.nl>
Date:   Sat Jul 11 11:24:50 2015 +0200

    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 3795e44..0cc8da7 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);
 };
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list