coc-jest icon indicating copy to clipboard operation
coc-jest copied to clipboard

Incorrectly resolves root in monorepo

Open joefiorini opened this issue 5 years ago • 9 comments

I have a monorepo with many package.json files throughout (managed with yarn workspaces). When I try to run :Jest or :JestCurrent it errors saying it can't find the Jest executable. In order to run it I have to first open my root level package.json.

It seems that the resolveRoot function uses findUp to find the nearest package.json and assumes that will be the location of Jest. Since I have multiple packages, it's most likely stopping too soon. Is there a reason not to use workspace.root from the coc.nvim plugin? I'm still new to this plugin and its ecosystem, but seems to be if something already has the root plugins should prefer that, no?

joefiorini avatar Aug 20 '19 21:08 joefiorini

I would also add myself to that question. It's a problem for yarn managed repositories. I would propose taking the workspace.root and adding a way to define our own independent files

Dammic avatar Sep 06 '19 07:09 Dammic

It could be improved, consider send PR.

chemzqm avatar Sep 09 '19 03:09 chemzqm

any further ? please ~

IndexXuan avatar Aug 23 '20 13:08 IndexXuan

@chemzqm hi! Can you give me permission to create PR I have PR with some stuff, like: -did some refactoring -using workspace.root as root dir -split logic in to different files

Geschoss avatar Sep 23 '20 07:09 Geschoss

@Geschoss you should

  1. fork this repo in yours, as your coc-jest
  2. clone it and do sth
  3. git push your forked one
  4. create pull request to origin coc-jest

IndexXuan avatar Sep 23 '20 07:09 IndexXuan

@IndexXuan nice, thank you!

Geschoss avatar Sep 23 '20 07:09 Geschoss

#9 need review=)

Geschoss avatar Sep 23 '20 07:09 Geschoss

@IndexXuan can you check new version?

Geschoss avatar Sep 23 '20 10:09 Geschoss

@Geschoss I will local build your code and check it in my project tomorrow. while I am just user of coc-jest.

IndexXuan avatar Sep 23 '20 12:09 IndexXuan