Closed tomspeak closed 2 years ago
Hi @tomspeak ,
When you execute run_file
, then there is no $result
replacement, this is only available for tests/test suites.
You could overwrite cmd
only for run
like this:
require"jester".run({ cmd = "NODE_PATH=. react-scripts test --testPathPattern=$file --testNamePattern='$result'" })
That's exactly what I needed thank you!
My final set up that's working is
MY_JESTER = require("jester")
MY_JESTER.setup({})
vim.api.nvim_set_keymap(
"n",
"<leader>t",
"<cmd>lua MY_JESTER.run({ cmd = 'NODE_PATH=. react-scripts test --testPathPattern=$file --testNamePattern=\\'$result\\'' })<CR>"
,
{ noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"<leader>T",
"<cmd>lua require'jester'.run_file({ cmd = 'NODE_PATH=. react-scripts test --testPathPattern=$file' })<CR>",
{ noremap = true }
)
I'm new to neovim/lua, appreciate if you spot anything bad!
I am using
create-react-app
so need to override thecmd
to make sure it's loaded correctly.This works great for
But it breaks
because it tries to filter test names matching
/$result/