neotest-jest
neotest-jest copied to clipboard
No tests found (unmatched filename)
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"]
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.