marklogic / mlxprs

MarkLogic Extension for Visual Studio Code
https://marklogic.github.io/mlxprs/
Other
20 stars 12 forks source link

Can't make it work with Marklogic Unit Test #195

Closed filetvignon closed 11 months ago

filetvignon commented 1 year ago

I haven't been able to make this extension work with marklogic's unit testing framework (https://developer.marklogic.com/code/marklogic-unit-test/)

I set the debugger configuration as such:

{
  "type": "ml-jsdebugger",
  "request": "attach",
  "name": "Attach to Remote JavaScript Request",
  "root": "${workspaceFolder}/src/test/ml-modules/root",
  "debugServerName": "data-hub-FINAL-TEST"
}

When I attach the request, it takes me to the first line of a suiteSetup.sjs file, but when I click continue nothing happens, and the test just stays as 'running' in the UI and never finishes.

Anyone has any ideas on this?

BillFarber commented 1 year ago

Hello filetvignon,

I have not attempted to use the debugger with the unit tests, but I will try to replicate this issue in the next day or so.

Since nothing is happening when you click continue, my guess is that something is causing an exception that is not being reported to the VSCode interface.

Are you "Connecting" to a JavaScript or XQuery debug server?

In the meantime, can you use the "Evaluate Current JavaScript Module" launch configuration to debug the test? My launch configuration for that is:

{
            "type": "ml-jsdebugger",
            "request": "launch",
            "name": "Evaluate Current JavaScript Module",
            "root": "${workspaceFolder}/src/main/ml-modules/root",
}
BillFarber commented 1 year ago

Hi,

I managed to get this to work last night, but I am definitely encountering problems. What I have found is that there seems to be at least 1 bug in the MLXPRS code related to breakpoints. If I have breakpoints defined before attaching to the paused request, then I am seeing problems and the debug session frequently fails.

However, the debug session seems to be reliable when I follow these steps:

  1. Remove ALL breakpoints before attaching to the request
  2. Attach to the request
  3. Add breakpoints where I need them At this point, everything runs smoothly and I'm able to use normal debug functionality successfully.

I will continue to research this. In the meantime, please try my method and let me know how things go.

mitchshepherd commented 11 months ago

Completed in 3.8 release