Open lukesarnacki opened 7 months ago
something like modulePathIgnorePatterns: ['dist'],
I don't have a ton of experience with jest
so maybe I am missing something but I think that there is an even easier way of doing this. The jest
command has the --listTests
option which should be enough to determine available tests without any custom code. The big advantage is that it uses jest config out of the box so the result will always match the tests that are actually run for the whole project.
Was there a specific reason why it hasn't been used?
I can't explain why you get treesitter errors for a dist
directory. That looks more like the errors you would get for outdated treesitter parsers.
Have you tried neotest's filter_dir
option (:h neotest.Config.discovery
)? I use it for this exact purpose which also speeds up test discovery quite a bit for larger repos.
neotest.setup({
discovery = {
filter_dir = function(name, rel_path, root)
return name ~= "dist"
end,
},
})
I think
is_test_file
is not based on jest.config.js currently.
It isn't no but it shouldn't match any files in dist
unless you are bundling tests.
Thanks for creating this plugin, it is awesome!
I have an issue with a typescript project with the
dist
directory. While it is ignored in thejest.config.js
, neotest considers it when detecting tests. This results in the error below. This doesn't happen when I delete thedist/
directory.This results in a weird behaviour. There is "no tests found" message but neotest sees tests as long as you open a file through a test summary window.
It would be great if either:
jest.config.js
was taken into consideration as there istestPathIgnorePatterns
attribute which already covers this; correct me if I am wrong: I thinkis_test_file
is not based onjest.config.js
currently.Let me know which approach would be better, I am happy to open a PR, thanks!