Skip to content

Commit

Permalink
Merge pull request #6 from meonkeys/dynamic-nightwatch-config
Browse files Browse the repository at this point in the history
use dynamic path to selenium server jar
  • Loading branch information
awatson1978 committed Apr 16, 2015
2 parents 31984f1 + fa0e176 commit a9c3b25
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
11 changes: 5 additions & 6 deletions bin/starrynight.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ var Future = require('fibers/future');
// so we can get the npm install prefix
var npm = require('npm');

// for _.extend()ing the process.env object
var _ = require('underscore');


//==================================================================================================
// FILE LINKING
Expand Down Expand Up @@ -543,12 +546,8 @@ function parseRunTestArguments(npmPrefix){
nightwatchCommand = 'nightwatch';
}

//console.log('Config file location: ' + configFileLocation);

// TODO: can we specify the server path via the command line, so it doesn't need to be in the json file?
// different node versions will break this
// alternatively, can we specify node 0.10.38 in particular?
var nightwatch = childProcess.spawn(nightwatchCommand, ['-c', configFileLocation], function(error, result){
var nightwatchEnv = _.extend(process.env, {npm_config_prefix: npmPrefix});
var nightwatch = childProcess.spawn(nightwatchCommand, ['-c', configFileLocation], {env: nightwatchEnv}, function(error, result){
if(error){
console.log("[StarryNight] ERROR spawning nightwatch: ", error);
//process.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion configs/nightwatch/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

"selenium" : {
"start_process" : true,
"server_path" : "/usr/local/lib/node_modules/starrynight/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.45.0.jar",
"server_path" : "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.45.0.jar",
"log_path" : "tests/nightwatch/logs",
"host" : "127.0.0.1",
"port" : 4444,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"request": "2.54.0",
"fibers": "^1.0.2",
"find-files": "^0.0.3",
"replace": "0.3.0"
"replace": "0.3.0",
"underscore": "^1.8.3"
},
"engines": {
"node": ">= 0.4.0"
Expand Down

0 comments on commit a9c3b25

Please sign in to comment.