From a7ff7a234972c62b2047692abf717623de14037e Mon Sep 17 00:00:00 2001 From: Jason Dobry Date: Fri, 22 Mar 2013 17:10:59 -0600 Subject: [PATCH] feat: use phantomjs npm module When the phantomjs npm module is installed it includes the phantomjs binary native to the OS. Using this binary allows Karma to launch tests via PhantomJS "out of the box," without the need for users to install PhantomJS manually or worry about configuring the path to their PhantomJS executable. Users are still free to install their own copy of PhantomJS and override the PHANTOMJS_BIN environment variable. Closes #1 --- .gitignore | 2 ++ index.js | 6 +++--- package.json | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc3df71 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +.idea/* \ No newline at end of file diff --git a/index.js b/index.js index 68f5689..f71c065 100644 --- a/index.js +++ b/index.js @@ -19,9 +19,9 @@ PhantomJSBrowser.prototype = { name: 'PhantomJS', DEFAULT_CMD: { - linux: 'phantomjs', - darwin: '/usr/local/bin/phantomjs', - win32: process.env.ProgramFiles + '\\PhantomJS\\phantomjs.exe' + linux: require('phantomjs').path, + darwin: require('phantomjs').path, + win32: require('phantomjs').path }, ENV_CMD: 'PHANTOMJS_BIN' }; diff --git a/package.json b/package.json index 7e80577..f7bcf56 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,9 @@ "phantomjs" ], "author": "Vojta Jina ", - "dependencies": {}, + "dependencies": { + "phantomjs": "~1.8" + }, "peerDependencies": { "karma": "~0.9" },