bashsupport-pro icon indicating copy to clipboard operation
bashsupport-pro copied to clipboard

Investigate debugging of bats-core tests

Open jansorg opened this issue 5 years ago • 9 comments

https://github.com/BashSupport-Pro/bashsupport-pro/issues/42

Investigate about the best way to debug bats files.

jansorg avatar Aug 19 '20 17:08 jansorg

Looks like I have that problem now. Not sure if it was caused by one of the resent updates. bats debugging used to work great and now I cannot debug either all bats or single bats anymore. I can run it, then it creates a configuration but debug symbol is disabled. I can create debug data, let me know how.

msandres13 avatar Jul 08 '21 11:07 msandres13

image

msandres13 avatar Jul 08 '21 11:07 msandres13

@msandres13 Thanks for reporting. Could you post the version of BashSupport Pro and of your IDE, please? (e.g. Help > About > Copy)

Debugging of bats-core was never supported so far, at least not intentionally. When you clicked "Debug" for a bats-core configuration, did it actually open the debugger and stop at breakpoints?

Adding breakpoints to .bats files shouldn't be possible, for example. The debug button should've been grayed out. But the version of the IDE might make a difference.

jansorg avatar Jul 08 '21 12:07 jansorg

CLion 2021.1.3 Build #CL-211.7628.27, built on July 1, 2021 Licensed to ... Subscription is active until July 23, 2021. Runtime version: 11.0.11+9-b1341.60 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 4.18.0-305.3.1.el8_4.x86_64 GC: G1 Young Generation, G1 Old Generation Memory: 2000M Cores: 12 Registry: run.processes.with.pty=TRUE Non-Bundled Plugins: com.carbonblack.intellij.rpmspec (1.2.0), com.intellij.plugins.visualstudiokeymap (211.6432.7), net.sjrx.intellij.plugins.systemdunitfiles (0.3.3), Docker (211.7442.9), pro.bashsupport (2.0.0.211-beta15-eap), idea.plugin.protoeditor (2.3.1) Current Desktop: GNOME

msandres13 avatar Jul 08 '21 12:07 msandres13

Debugging of bats-core was never supported so far, at least not intentionally. When you clicked "Debug" for a bats-core configuration, did it actually open the debugger and stop at breakpoints? Yes, it did. I did set the breakpoint not in the bats, I set it in the code called in the testcase. I could not set a breakpoint in the bats itself nor run the debugger there.

msandres13 avatar Jul 08 '21 12:07 msandres13

I also recognized that the bats icon in screen shoot I sent above is now grayed out.

msandres13 avatar Jul 08 '21 12:07 msandres13

@msandres13 Thanks. You seem to have found a workaround to make the debugger run a bats test :) I'll see if I can reproduce this and if it's possible to enable it for all (again).

Because bats-core files are not syntactically correct bash, it wasn't enabled (intentially) yet. A transformation of the bats-core test into valid bash has to happen first to allow breakpoints in it and to allow debugging. But I'll see what I can do with that workaround...

The grayed out icon is telling that the run configuration isn't saved, i.e. it's a temporary configuration. That's the same treatment as with any other type of run configuration.

You're using a 2.0 preview. If you need debugging of bats, please try to uninstall the 2.0 preview and install the current stable version 1.5.20.211 again.

jansorg avatar Jul 08 '21 12:07 jansorg

Ok, I will try the workaround. I hope you can find a solution. Thanks for your help.

msandres13 avatar Jul 08 '21 12:07 msandres13

I would sure love to be able to debug bats tests.

rfay avatar Jan 17 '22 21:01 rfay