David-Kunz / jester

A Neovim plugin to easily run and debug Jest tests
The Unlicense
202 stars 12 forks source link

"No active session" when I run `require"jester".debug()` #17

Open mawkler opened 2 years ago

mawkler commented 2 years ago

Hi! When I run require"jester".debug() on a jest test I get the message "No active session". If I run require"jester".debug_file() nothing happens. Do you know what I could be doing wrong?

Here's a link to my dap/jester configuration.

David-Kunz commented 2 years ago

Hi @melkster ,

Thanks for reaching out to me. Unfortunately I'm not sure what the root cause is, but I can give you my own configuration:

dap.adapters.node2 = {
  type = 'executable',
  command = 'node',
  args = {os.getenv('HOME') .. '/apps/node/out/src/nodeDebug.js'}, -- adjust the path!
}

Could you kindly try it out with this config?

Thanks and best regards, David

mawkler commented 2 years ago

@David-Kunz I think I found the problem: the debugger tries to run ~/node_modules/.bin/jest even though my workspace, or Neovim's cwd isn't in my home directory. If I first navigate to the project's working directory and then open Neovim the correct Jest path is used. So is there a problem with how Jester computes Neovim's current working directory?

Now I also get another weird behaviour when using your config: After setting a breakpoint and doing require"jester".debug() I get the error message "Breakpoint ignored because generated code not found (source map problem?).", but after maybe one second DAP starts working and I see DAP stopping at my breakpoint as intended.

mawkler commented 2 years ago

I'm guessing that the first problem is here since cwd only gets computed once when jester is loaded.

David-Kunz commented 2 years ago

Hi @melkster,

"Breakpoint ignored because generated code not found (source map problem?)."

Yes, I also get this warning sometimes (even though everything works). This seems to be a problem with nvim-dap, you can open an issue there if it bugs you too much.

since cwd only gets computed once when jester is loaded.

Oh thanks for the hint! I fixed it: https://github.com/David-Kunz/jester/commit/5b66eb7ac3ed1cb9369cb7e556baef1fd48dc1b5

Best regards, David

mawkler commented 2 years ago

Ok, thank you!

David-Kunz commented 2 years ago

Hi @melkster ,

I followed the discussion and saw that the default configuration seems to be wrong, I fixed that in the newest version of Jester.

Thanks for the report and best regards, David

mawkler commented 2 years ago

After updating, the error message seems to have changed to "Breakpoint set but not yet bound". Also, the "No active session" message still is printed when I do require('jester').debug() :thinking:

David-Kunz commented 2 years ago

Thanks @melkster , I'll have a look.

gxbsst commented 1 year ago

I have same issue.:-(

dimas-cyriaco commented 1 year ago

I'm having this problem too.

Hugobsb commented 10 months ago

@David-Kunz @dimas-cyriaco @gxbsst hey! I hope you are doing well.

Removing the cwd option from dap config resolved the problem for me. Have you tried that?