avajs / atom-ava

Snippets for AVA and run tests directly in the editor
https://atom.io/packages/ava
MIT License
103 stars 20 forks source link

prefer local ava if available, fallback to global #20

Closed nerdgore closed 8 years ago

nerdgore commented 8 years ago

If ava is installed as a module, use this over the globally installed instance. An improvement on this PR would be to even add this as an option in the plugin UI. Fixes #19

I am not quite sure if spying on fs.existsSync is the proper way to implement the test for this. I am open for suggestions.

sindresorhus commented 8 years ago

AVA already handles using the local version when available. The correct change would be to use the AVA version that is the dependency of this plugin, instead of the globally installed one. This should wait until https://github.com/avajs/atom-ava/pull/18, as that PR touches the same code.

nerdgore commented 8 years ago

Ah okay, I missed this in the documentation. So if I understand correctly if atom-ava/node_modules/.bin/ava is used it will figure out that I have my_open_atom_project/node_modules/.bin/ava and use this instead? If so this PR will be obsolete.

jamestalmage commented 8 years ago

@nerdgore - Actually, AVA itself already handles this here.

nerdgore commented 8 years ago

Great. Thank you. So everything I asked for is already there, it's just that for the time being I need AVA globally.

jamestalmage commented 8 years ago

it's just that for the time being I need AVA globally.

Ah. I see what you are getting at now. In that case, I think this PR still has merit then.

I would prefer it was redone to mimic how AVA itself locates the local install (see linked code above).

sindresorhus commented 8 years ago

@jamestalmage I've already outlined what needs to be done in https://github.com/avajs/atom-ava/pull/20#issuecomment-224618995. AVA is a dependency on this plugin, so we just need to use it instead of the global.