Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer the locally installed version of AVA. #277

Merged
merged 1 commit into from
Nov 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@

var debug = require('debug')('ava');

// Prefer the local installation of AVA.
var resolveFrom = require('resolve-from');
var localCLI = resolveFrom('.', 'ava/cli');

if (localCLI && localCLI !== __filename) {
debug('Using local install of AVA.');
require(localCLI);
return;
}

if (debug.enabled) {
require('time-require');
}
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"power-assert-renderers": "^0.1.0",
"pretty-ms": "^2.0.0",
"require-from-string": "^1.1.0",
"resolve-from": "^1.0.0",
"resolve-from": "^2.0.0",
"serialize-error": "^1.1.0",
"set-immediate-shim": "^1.0.1",
"source-map-support": "^0.3.3",
Expand All @@ -128,5 +128,10 @@
"test[/\\\\]"
]
}
},
"xo": {
"ignore": [
"cli.js"
]
}
}
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ $ ava --help

Files starting with `_` are ignored. This can be useful for having helpers in the same directory as your test files.

*WARNING: NON-STANDARD BEHAVIOR:* The AVA CLI will always try to find and use your projects local install of AVA. This is true even when you run the global `ava` command. This non-standard behavior solves an important [issue](https://github.com/sindresorhus/ava/issues/157), and should have no impact on everyday use.

## Documentation

Expand Down