NeoVim NeoTest how to debug "No test files found"

I honestly don’t understand how to debug LazyVim setup and if anyone can give me pointers I would appreciate. I would like to fish instead of giving me fish . . .

Here is the LazyVim .config/nvim/lua/plugins/neotest.lua I have but reports “no test files found” when I try and use it. I have read treesitter needs to be loaded after the language server but I don’t know if that is happening or how to figure it out. I feel like the egg trying to debug the chicken.

return {
  "nvim-neotest/neotest",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "nvim-neotest/nvim-nio",
    "antoinemadec/FixCursorHold.nvim",
    "nvim-treesitter/nvim-treesitter",
    "adrigzr/neotest-mocha",
  },
  opts = function()
    return {
      adapters = {
        ["neotest-mocha"] = {
          command = "npx mocha --",
          command_args = function(context)
            -- The context contains:
            --   results_path: The file that json results are written to
            --   test_name_pattern: The generated pattern for the test
            --   path: The path to the test file
            --
            -- It should return a string array of arguments
            --
            -- Not specifying 'command_args' will use the defaults below
            local relative_path = vim.fn.fnamemodify(context.path, ":.")
            return {
              "--full-trace",
              "--reporter=json",
              "--reporter-options=output=" .. context.results_path,
              "--grep=" .. context.test_name_pattern,
              relative_path,
            }
          end,
          env = { CI = true },
          cwd = function()
            return vim.fn.getcwd()
          end,
        },
      },
      consumers = {
        overseer = require("neotest.consumers.overseer"),
      },
    }
  end,
}```

What version of mocha/node are you using ?

At home I am running the latest.
$ mocha --version
11.7.2
$ node --version
v24.7.0

At work
$ mocha --version
10.8.2
$ node --version
v22.14.0

This use to work with AstroVim until I did an update last week. I’m now trying to simplify configs using LazyVim. My neotest file for AstoVim is in my blog post https://blog.geoffcorey.com/astronvim-neovim-javascript-mocha-test-runner/

I don’t see anything wrong with your config, maybe the way the json reporter work changed, or it’s the good old grep problem, sorry but no idea :confused: you will need someone more competent for this one :laughing:

Hmmm, I think I have it figured out. On the home machine the project I checked out node-coveralls didn’t name the test fn.test.js They just had tests/fn.js I renamed the file and it worked

Figured it out . . . here is the write up. Hope this helps others with this type of issue.