Skip to content

Commit

Permalink
Updated exit if path argument not found to just be a warning. Moved t…
Browse files Browse the repository at this point in the history
…he warning to be in the stdout
  • Loading branch information
chafnan committed Sep 24, 2013
1 parent 5f924f4 commit 242a267
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bin/mocha-phantomjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ var spawnArgs = [script, page, reporter, config];

var phantomjs;
if (program.path !== undefined) {
if (!exists(program.path)) {
print("PhantomJS does not exist at '" + program.path + "'\n");
process.exit(1)
if (exists(program.path)) {
phantomjs = spawn(program.path, spawnArgs);
} else {
console.error("PhantomJS does not exist at '" + program.path + "'. Looking for PhantomJS in the PATH.");
}
phantomjs = spawn(program.path, spawnArgs);
}
if (phantomjs === undefined) {
cmd = which.sync('phantomjs');
Expand Down
3 changes: 1 addition & 2 deletions test/lib/mocha-phantomjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions test/src/mocha-phantomjs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ describe 'mocha-phantomjs', ->
# assumption here is that phantomjs is working correctly, so giving the wrong path
# will cause the runner to fail, there should be an output to explain this to the user
@runner done, ['-p', 'fake/path/to/phantomjs', fileURL('passing')], (code, stdout, stderr) ->
expect(code).to.equal 1
expect(stdout).to.match /PhantomJS does not exist at 'fake\/path\/to\/phantomjs'/
expect(stderr).to.contain "PhantomJS does not exist at 'fake/path/to/phantomjs'. Looking for PhantomJS in the PATH."

describe 'env', ->
it 'has passed environment variables', (done) ->
Expand Down

0 comments on commit 242a267

Please sign in to comment.