Skip to content

[BUG] Failes to watch filepaths with $ or ( etc. #525

@justb3a

Description

@justb3a

NeoVim Version
v0.11.2

Describe the bug
When watching files with "special characters" in the file path, the watch mode is not working. When I start the watch mode, it runs the tests once, but on save they do not re-run. I checked and the characters are properly escaped in the filepath. It works perfectly fine as soon as the filepath does not contain such characters. Unfortunately, I cannot avoid using such characters.

  • app/routes/_app.segment.articles_.$articleId.$entity.edit.($kind)/routes.test.ts does not work in watch mode
  • app/components/example/example.test.ts works perfectly fine

To Reproduce

return {
  'nvim-neotest/neotest',
  dependencies = {
    'nvim-neotest/nvim-nio',
    'nvim-lua/plenary.nvim',
    'antoinemadec/FixCursorHold.nvim',
    'nvim-treesitter/nvim-treesitter',
    -- Choose the adapter for your test framework
    'marilari88/neotest-vitest', -- for Vitest
  },
  keys = {
    {
      '<leader>t',
      function()
        require('neotest').run.run(vim.fn.expand '%')
      end,
      desc = 'Run tests in current file',
    },
    {
      '<leader>tw',
      function()
        local neotest = require 'neotest'
        neotest.watch.toggle(vim.fn.expand '%')
        -- neotest.watch.watch(vim.fn.expand '%')
        neotest.summary.toggle()
      end,
      desc = 'Watch current file tests with summary',
    },
  },
  config = function()
    local neotest = require 'neotest'

    neotest.setup {
      adapters = {
        require 'neotest-vitest' {
          filter_dir = function(name, rel_path, root)
            return name ~= 'node_modules'
          end,
        },
      },
    }
  end,
}

Steps to reproduce the behavior:

  1. Add $, ( or similar to a folder name
  2. Run watch mode
  3. :w

Expected behavior
Watch mode does always work :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions