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 installation #19

Closed nerdgore closed 5 years ago

nerdgore commented 8 years ago

Due to restrictions in our build pipeline we are installing all modules locally.

To avoid running into version mismatches, it would be great if the local version ./node_modules/.bin/ava could be preferred over the global.

sindresorhus commented 8 years ago

👍 Yup. That's the plan.

pho3nixf1re commented 6 years ago

This doesn't appear to be working. I do not have ava installed globally but it is a dependency of all my projects. When running tests Atom is throwing an error in the console with the message to be sure ava is installed and available in my PATH. According to discussions here and in related PR's this should not be happening. Is this still an outstanding issue?

novemberborn commented 6 years ago

@pho3nixf1re how are you using Atom? Do you open an Atom instance for each project, and does each project have an explicit dependency on AVA? The way you've phrased your question I'm thinking maybe you have a workspace with multiple projects, but AVA is not installed in the top-level directory.

pho3nixf1re commented 6 years ago

I have a few different configurations. My primary use case is a project that has multiple services each with their own dependencies (a mono-repo). My expectation is that the AVA plugin would work like ESLint where it uses the version of AVA closest to the file in question when running on a specific file (my main use case for this plugin).

novemberborn commented 6 years ago

@pho3nixf1re whilst I haven't used atom-ava, looking at the code I think it currently requires AVA to be installed globally. The global installation then knows how to find any local ones and uses that.

Your use case makes sense. I think this package should attempt to discover any installations relative to the file and use those instead. The starting point is here I think: https://github.com/avajs/atom-ava/blob/3057244249845e0f5437f872f9e637cde1c36043/lib/test-runner-process.js#L50

Sighery commented 5 years ago

Sorry for all the rebase noise, folks. I kept finding little linting errors just after pushing every single time. I'm still setting up my system so I don't have all my linting packages installed and I'd only notice afterwards by reviewing the code on GitHub. That being said, the good news is that this issue should now be fixed with this PR: https://github.com/avajs/atom-ava/pull/28