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

support reading package.json from non-root cwd #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbriggs
Copy link

@mbriggs mbriggs commented Nov 6, 2019

This is an extremely minor change to allow for reading package.json in a non root location. I am doing client work on a massive repository, and frequently will :cd into a project directory when I am working on it in order to have a sane fzf experience :)

@@ -4,7 +4,8 @@ let test#javascript#patterns = {
\}

function! test#javascript#has_package(package) abort
for line in readfile('package.json')
let json_path = findfile('package.json', '.;')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get this to exclude node_modules as that will contain main package.json files

@codeinabox
Copy link
Collaborator

Thank you for this pull request. My only reservation is we might need to update all the runners as they presume that the node_modules directory which can contain the test runner binary is in the current working directory.

@ShahinSorkh
Copy link
Contributor

I guess you can use npx or yarn dlx to run the runner instead of checking a hard-coded path.
It will check the project root if find one, and then will install the requested runner if is not installed as a dependency.

@ShahinSorkh
Copy link
Contributor

yarn dlx: https://yarnpkg.com/cli/dlx
npx: https://www.npmjs.com/package/npx

Note: npx is usually bundled with npm.

@fnune
Copy link

fnune commented Nov 9, 2020

This patch makes vim-test work on my monorepo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants