nvim-neotest / neotest-jest

MIT License
116 stars 79 forks source link

No tests found error in react project with create-react-app #74

Open giuxtaposition opened 1 year ago

giuxtaposition commented 1 year ago

As the title says, the current strategy of checking that jest is a dependency in the package.json does not work with project bootstrapped with create-react-app because jest is included as a dependency of react-scripts.

As a workaround I added it as explicit dependency in my project, but isn't there a better solution?

Jamie-505 commented 11 months ago

Hi @giuxtaposition, you can check out my PR #80 and see if that might help in your case

Zik42 commented 7 months ago

@Jamie-505 Good, but it does not suit case with default create-react-app case. It should read nested dependencies, or try to run yarn test command to determinate test runner. I tried you fork.

bad4iz commented 7 months ago

this is very relevant and necessary. How are things progressing on this issue?

weilbith commented 6 months ago

I can get the detection to work if I locally adapt the package.json dependency detection. But unfortunately I can't get it to read the right Jest configuration. At least it is unable to parse the TypeScript (Jest error when running a test).

rguruprakash commented 6 months ago

Maybe I didn't get it completely. but why do we need jest detection to determine if something is a test file? isn't the pattern matching here enough?

I removed jest detection from my local branch and it works great. (I work on 3 considerable-sized typescript projects and one of them is mono repo)

weilbith commented 6 months ago

Maybe I didn't get it completely. but why do we need jest detection to determine if something is a test file? isn't the pattern matching here enough?

I don't think so. That is just a file name pattern, right? There are many other testing frameworks which use similar naming concepts. Like Vitest for example (very related I know, but would be a different neotest adapter).

rguruprakash commented 6 months ago

@weilbith Thanks. I get it now.