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

Neotest introduces a lot of lag when not testing #485

Open
schester44 opened this issue Feb 12, 2025 · 0 comments
Open

Neotest introduces a lot of lag when not testing #485

schester44 opened this issue Feb 12, 2025 · 0 comments

Comments

@schester44
Copy link

schester44 commented Feb 12, 2025

Let me know if there is more I can provide here but i'm seeing severe lag / freezing (entire neovim program freezes) when browsing files after testing with neotest. I'm using the basic run test file and run nearest test commands. I've attached my config below and a screenshot from a profiler. Is this expected or am I doing something wrong?

Image

Config

return {
  'nvim-neotest/neotest',
  dependencies = {
    'nvim-neotest/nvim-nio',
    'nvim-lua/plenary.nvim',
    'antoinemadec/FixCursorHold.nvim',
    'nvim-treesitter/nvim-treesitter',
    'marilari88/neotest-vitest',
    'adrigzr/neotest-mocha',
  },
  config = function()
    -- Keymaps
    vim.keymap.set('n', '<leader>Tf', function()
      require('neotest').run.run(vim.fn.expand '%')
    end, { desc = 'Run [T]est [F]ile' })

    vim.keymap.set('n', '<leader>Tl', function()
      require('neotest').run.run_last()
    end, { desc = 'Run Last Test' })

    vim.keymap.set('n', '<leader>Tn', function()
      require('neotest').run.run()
    end, { desc = 'Run [T]est [N]earest' })

    vim.keymap.set('n', '<leader>Ts', function()
      require('neotest').run.stop()
    end, { desc = '[T]est [S]top' })

    vim.keymap.set('n', '<leader>Twf', function()
      require('neotest').watch.watch(vim.fn.expand '%')
    end, { desc = 'Run [T]est [W]atch [F]ile' })

    vim.keymap.set('n', '<leader>Twn', function()
      require('neotest').watch.watch()
    end, { desc = 'Run [T]est [W]atch [N]earest' })

    vim.keymap.set('n', '<leader>Twsn', function()
      ---@diagnostic disable-next-line: missing-parameter
      require('neotest').watch.stop()
    end, { desc = '[T]est [W]atch [S]top [N]earest' })

    vim.keymap.set('n', '<leader>Twsf', function()
      require('neotest').watch.stop(vim.fn.expand '%')
    end, { desc = '[T]est [W]atch [S]top [F]ile' })

    vim.keymap.set('n', '<leader>TO', function()
      require('neotest').summary.toggle()
    end, { desc = '[T]est Summary [O]utput' })

    vim.keymap.set('n', '<leader>To', function()
      require('neotest').output_panel.toggle()
    end, { desc = '[T]est [O]utput' })

    --- Adapters
    local neotest = require 'neotest'

    ---@diagnostic disable-next-line: missing-fields
    neotest.setup {
      projects = {
        ['/Users/me/project/api'] = {
          default_strategy = 'integrated',
          discovery = { enabled = true, concurrent = 0 },
          running = { concurrent = false },
          adapters = {
            require 'neotest-mocha' {
              command = 'yarn test',
              cwd = '/Users/me/project/api',
            },
          },
        },
        ['/Users/me/project/web'] = {
          default_strategy = 'integrated',
          discovery = { enabled = true, concurrent = 0 },
          running = { concurrent = true },
          adapters = {
            require 'neotest-vitest' {
              vitestCommand = 'yarn test',
              cwd = '/Users/me/project/web',
            },
          },
        },
      },
    }
  end,
}
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

1 participant