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

All Tests Are Skipped #66

Open
jrock2004 opened this issue Nov 17, 2024 · 2 comments
Open

All Tests Are Skipped #66

jrock2004 opened this issue Nov 17, 2024 · 2 comments

Comments

@jrock2004
Copy link

So in my project if I run pnpx vitest the test will run and I even see a test failure. But with neotest it just skips them all. Not sure what I am doing wrong. Here is my Lazyvim neotest config:

return {
  "nvim-neotest/neotest",
  dependencies = {
    "haydenmeade/neotest-jest",
    "marilari88/neotest-vitest",
  },
  opts = {
    adapters = {
      ["neotest-vitest"] = {
        vitestCommand = "pnpx vitest",
        env = { CI = true },
        cwd = function()
          return vim.fn.getcwd()
        end,
      },
      ["neotest-jest"] = {
        -- jestCommand = 'npm test --',
        jestCommand = "pnpm test --",
        -- jestCommand = "yarn test",
        -- jestConfigFile = 'custom.jest.config.ts',
        env = { CI = true },
        cwd = function()
          return vim.fn.getcwd()
        end,
      },
    },
  },
}

If you need to see the repo where I am running tests, you can see them here.

image
@kingsleyzissou
Copy link

I am running into the same issue, I've checked the logs and there doesn't seem to be anything interesting there: neotest.log

The json output file has the following:

{
  "numTotalTestSuites": 105,
  "numPassedTestSuites": 105,
  "numFailedTestSuites": 0,
  "numPendingTestSuites": 0,
  "numTotalTests": 263,
  "numPassedTests": 0,
  "numFailedTests": 0,
  "numPendingTests": 263,
  "numTodoTests": 0,
  ...
}

Screenshot of the summary:
image

@kingsleyzissou
Copy link

I've done some further debugging and it seems to be the testNamePattern part of the command. If a file is passed the testNamePattern is set to .* but if a directory is passed in it ends up with:

"--testNamePattern=^\\s?frontend"

If I replace the testNamePattern with .* then the tests run fine.

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

2 participants