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

Running vim-test in javascript or typescript results in "No test file" #660

Open
ScopeSV opened this issue Jun 8, 2022 · 7 comments
Open

Comments

@ScopeSV
Copy link

ScopeSV commented Jun 8, 2022

I've searched around without finding a solution, and I'm not entirely sure how to go further in debugging this.
I've tried renaming the file .test.ts and _test.ts, which nothing seem to work. Also tried running javascript files, no luck.
I've tried with both jest and mocha. I can assure you that the libraries are in package.json

the vim-test installation should be ok as I'm able to run tests written in Go.
It's a clean vim-test install with no extra configuration
any suggestions?

@codeinabox
Copy link
Collaborator

What happens if you open one of the fixture folders for the jest or mocha specs and try running vim-test?

@ScopeSV
Copy link
Author

ScopeSV commented Jun 8, 2022

Not entirely sure if you're talking about specific fixture folders for something.
The test files in the projects I've tried are mainly just unit tests. The tests are usually close to the file containing the code that's being tested. I've also tried putting test files in directories, tests __tests__ and so forth and so on, but it doesn't seem to help

@hendrikbursian
Copy link

hendrikbursian commented Jun 21, 2022

I have the same error, although I must say I haven't used the plugin in a while.
Tested also with older versions of the plugin but the error resides.

NVIM v0.8.0-dev+448-g7b2b44bce

@hendrikbursian
Copy link

hendrikbursian commented Jun 21, 2022

Okay found it for me.

In our project we are using yarn (node-linker). Which when I initially ran it didn't work.
I installed the packages with npm (creating the package-lock.json) and it worked.

I tested further, turns out all that's needed is a empty package-lock.json (containing {}) for vim-test to start running the tests.
When I remove the empty package-lock.json again it fails again.

@NervosaX
Copy link

NervosaX commented Jul 20, 2022

The above fix does nothing for me, I'm using a monorepo with https://rushjs.io/ (which uses pnpm underneath).

Edit: There's a package.json in the src folder that is required for running nwjs/electron, and vim-test is finding this over the one in root. It then determines it does not in fact contain jest.

I've fixed this by renaming the file and having it moved to the right spot by webpack.

@maciej-w
Copy link

maciej-w commented Sep 10, 2022

@NervosaX what exactly did you do? I'm using a monorepo (with a package.json in root folder) and not sure what you mean. I installed jest in root but that is not what I want, would be nice to be able to set something like workingDirectory in eslint Actually I found the setting and set the working directory to the app I'm working on

@Warkanlock
Copy link

I'm using a monorepo as well and what it worked for me was to move the cwd to the project I was trying to run the test in;

My example:

> root
    - projectA
    - projectB

so I moved my current working directory into projectB and problem solved, it seems to be that the library takes the root as the main entry path to check for tests, which is not ideal for a monorepo structure

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

No branches or pull requests

6 participants