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

Another "No Tests Found" Error #85

Open
vbfischer opened this issue Oct 23, 2023 · 3 comments
Open

Another "No Tests Found" Error #85

vbfischer opened this issue Oct 23, 2023 · 3 comments

Comments

@vbfischer
Copy link

My configuration is based on LazyVim, having added support for Neotest by including the appropriate "extras" configuration.

{import = "lazyvim.plugins.extras.test.core" }

To ensure it wasn't an issue with my original project, I created a simple Next.js project here.

Additional configuration is specified in lua/plugins/test.lua with the following content:

return {
  {
    "haydenmeade/neotest-jest",
  },
  {
    "nvim-neotest/neotest",
    dependencies = { "haydenmeade/neotest-jest" },
    opts = function(_, opts)
      table.insert(
        opts.adapters,
        require("neotest-jest")({
          jestCommand = "npm test --",
          jestConfigFile = "jest.config.js",
          cwd = function()
            return vim.fn.getcwd()
          end,
        })
      )
    end,
  },
}

I have verified that package.json contains a script "test": "jest --watch".

I have verified that running the following on the command line works: npm run test.

I have verified that neotest-jest is apparently finding jest in devDependencies.

I have looked at what file_path parameter the function adapter.is_test_file is receiving, and it is NOT the file that "Run Nearest" was executed in.

I'm pretty sure Its something I'm doing wrong, but I've exhausted my current thoughts on what the issue might be... Any help would be appreciated, even if its tips on debugging.

@vbfischer
Copy link
Author

Answer from Here

added treesitter to dependencies:

    dependencies = {
      "nvim-treesitter/nvim-treesitter", -- this adding nvim-treesitter,
      "haydenmeade/neotest-jest",
    },


@folke
Copy link

folke commented Oct 26, 2023

This has been fixed in LazyVim in the meantime, so this can be closed...

@iryan2
Copy link

iryan2 commented Dec 21, 2023

@folke Thanks for all your amazing work. Just as a data point, I've been trying to get neotest-jest working via :LazyExtras for a few hours now, and it was this thread, specifically adding the treesitter dependency as described above that finally resolved it. With the line there, it works, without it I get "No tests found". I'm on LazyVim 10.8.2, nvim v0.9.4, MacOS 14.2.1.

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

3 participants