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

No tests found (unmatched filename) #97

Open
mhuggins7278 opened this issue Jan 6, 2024 · 1 comment
Open

No tests found (unmatched filename) #97

mhuggins7278 opened this issue Jan 6, 2024 · 1 comment

Comments

@mhuggins7278
Copy link

mhuggins7278 commented Jan 6, 2024

I'm working on a legacy project at work and all the test files are named like *.tests.ts

This is causing a no tests found error. It looks like the filename matching is using a hard-coded list of file names and extensions defined here. https://github.com/nvim-neotest/neotest-jest/blob/main/lua/neotest-jest/init.lua#L107

Wouldn't it be better to use the pattern matching defined in the user's jest config or allow the user to define custom filename patterns.

for example, in the jest config in the project we are working on we using the following pattern:

  testMatch: ["**/?(*.)+(e2e|tests).[jt]s"]
@alejandroclaro
Copy link

alejandroclaro commented Jan 9, 2024

Same problem here.

Also, the condition that 'jest' must be a dependency in the package.json is too strong for some uses cases. In my case, we have the dependency encapsulated in another package with abstractions and helpers for test run.

It would be nice if is_test_file could be overridden as other adapters allow.

I was as able to override the function in the adapter,

  local jest_adapter = require('neotest-jest')({ jestCommand = 'yarn run jest', jestConfigFile = _G.jtest_config_file, cwd = _G.jtest_cwd })

  jest_adapter.is_test_file = _G.jtest_is_test_file

but it was not pleasant as it could be through the config table.

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