nvim-neotest / neotest-jest

MIT License
116 stars 79 forks source link

`watch` mode not work without global jest #78

Closed tuanbass closed 11 months ago

tuanbass commented 11 months ago

I try both:

require('neotest').setup({
  ...,
  adapters = {
    require('neotest-jest')({
      jestCommand = "jest --watch ",
    }),
  }
})

and

lua require('neotest').run.run({ jestCommand = 'jest --watch ' })

Both produces error message:

Vim:E475: Invalid value for argument cmd: 'jest' is not executable

Install jest at global solve problem, but it's not what I would like to do, as I work in different project which using different version of jest. neotest should use jest in the project, not the global one.

KostkaBrukowa commented 11 months ago

If you are using npm you could try lua require('neotest').run.run({ jestCommand = 'npx jest --watch ' }) It search for local package at first

tuanbass commented 11 months ago

If you are using npm you could try lua require('neotest').run.run({ jestCommand = 'npx jest --watch ' }) It search for local package at first

@KostkaBrukowa. Thanks for the answer.
Actually, it's exactly what I used to overcome the issue. (even though, it's a small annoy, when I'm using yarn as the package manager, and only npm for npx).

Could we update this into the README? it took me few hours to figure out why my test does not run.

KostkaBrukowa commented 11 months ago

You can probably make a PR with explanation if you want (I'm not the maintainer) But on the other hand "yarn" also have its own "npx". It's just "yarn jest --watch" and it should work the same