I'm a newcomer to neovim and currently having trouble getting DAP to work. More specifically, getting skipFiles to work. I've tried out many different patterns for skipFiles and found no success.
Every time I put a breakpoint in a jest test or a mocha test and it runs into an async method, it takes me to a promiseAfterHook function, then to primiseBeforeHook, then to promiseRejectHandler, then to primiseAfterHook, then to processTicksAndRejections, then to emitHook... I believe these are methods in node_internals that should be ignored.
But then in the test below it doesn't jump to node internal method for console.log and steps over it just fine so this may just be a debugger issue handling async await?
it('testing debugger', async () => {
B 5 console.log('hello');
▎ 4 console.log('hi');
▎ 3 const x = 5 + 50;
▎ 2 const y = 6;
▎ 1 console.log(x + y)
契47 const somePromise = await thisIsTheProblemLine();
Any help would be appreciated. Thank you.
Here are my dap configs:
local home = os.getenv("HOME")
local dap = require("dap")
dap.adapters.node2 = {
type = "executable",
command = "node",
args = { home .. "/personal/microsoft-sucks/vscode-node-debug2/out/src/nodeDebug.js" },
}
dap.configurations.javascript = {
{
name = "Launch",
type = "node2",
request = "launch",
program = "${file}",
cwd = vim.loop.cwd(),
sourceMaps = true,
protocol = "inspector",
console = "integratedTerminal",
},
{
-- For this to work you need to make sure the node process
-- is started with the `--inspect` flag.
name = "Attach to process",
type = "node2",
request = "attach",
processId = require("dap.utils").pick_process,
},
{
name = "Debug Mocha Tests",
type = "node2",
request = "launch",
cwd = vim.loop.cwd(),
runtimeArgs = {
"--inspect-brk",
"${workspaceFolder}/node_modules/mocha/bin/_mocha",
},
sourceMaps = true,
protocol = "inspector",
runtimeExecutable = "node",
args = {"inspect", "${file}" },
port = 9229,
console = "integratedTerminal",
skipFiles = {
"<node_internals>/**",
"node_modules/**",
}
},
}
dap.configurations.typescript = {
{
name = "ts-node (Node2 with ts-node)",
type = "node2",
request = "launch",
cwd = vim.loop.cwd(),
runtimeArgs = { "-r", "ts-node/register" },
runtimeExecutable = "node",
args = { "--inspect", "${file}" },
sourceMaps = true,
skipFiles = { "<node_internals>/**", "node_modules/**" },
},
{
name = "Jest (Node2 with ts-node)",
type = "node2",
request = "launch",
cwd = vim.loop.cwd(),
runtimeArgs = { "--inspect-brk", "${workspaceFolder}/node_modules/.bin/jest" },
runtimeExecutable = "node",
args = { "${file}", "--runInBand", "--coverage", "false" },
sourceMaps = true,
port = 9229,
skipFiles = {
"<node_internals>/**",
"node_modules/**",
},
},
}