neotest-jest
neotest-jest copied to clipboard
More detailed installation guide
I am really having a hard time setting neotest and neotest-jest up. Can someone maybe make a setup guide for dummys?
What problems do you have exactly?
This is my config and works quite well: https://github.com/primeapple/dotfiles/blob/main/.config/nvim/lua/plugins/neotest.lua
What problems do you have exactly?
This is my config and works quite well: https://github.com/primeapple/dotfiles/blob/main/.config/nvim/lua/plugins/neotest.lua
Copying your setup, in an spec.js files, the output I get is "No tests found"
I'm using nvim 0.9.0 using NvChad on MacOS Ventura. The tests I'm running are in a Vue project.
Are you using parameterized Tests? They don't work yet: https://github.com/haydenmeade/neotest-jest/pull/51
Other than that it'd be helpful to see the test file.
You have the javascript
Treesitter parser installed?
If you are using lazy, you can just copy-paste this config:
{
"nvim-neotest/neotest",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
"nvim-neotest/neotest-jest"
},
opts = {
adapters = {
require("neotest-jest")
}
},
keys = {
{
"<leader>tt",
function() require("neotest").run.run(vim.fn.expand("%")) end,
desc =
"Run File"
},
{
"<leader>tT",
function() require("neotest").run.run(vim.loop.cwd()) end,
desc =
"Run All Test Files"
},
{
"<leader>tr",
function() require("neotest").run.run() end,
desc =
"Run Nearest"
},
{
"<leader>ts",
function() require("neotest").summary.toggle() end,
desc =
"Toggle Summary"
},
{
"<leader>to",
function() require("neotest").output.open({ enter = false, auto_close = true }) end,
desc =
"Show Output"
},
{
"<leader>tO",
function() require("neotest").output_panel.toggle() end,
desc =
"Toggle Output Panel"
},
{
"<leader>tS",
function() require("neotest").run.stop() end,
desc =
"Stop"
},
},
},
If not, make sure both "neotest" and "neotest-jest" are installed, and then call setup with the adapter:
require("neotest").setup({
adapters = {
require("neotest-jest")
}})
The test it with :lua require("neotest").run.run()
or set a keymap for it.
Bumping this issue, it would be super helpful to have an example repo that tests work in.
I too am banging my head against the "No tests found" error. I have a project where npm test
is mapped to jest
, and running that works just fine, but trying to run :lua require("neotest").run.run()
produces the "No tests found" error everytime. I have neotest working for go
just fine. I have both the typescript
and javascript
treesitter languages installed, and I'm really at a loss as to how to troubleshoot this futher?
For those who keep getting 'no test found' when running the test, the solution for me was to run :TSInstall <language>
.