I'm building an open source Node.js debugger that is an electron app and uses the built in debugger in the render process. Full source: https://github.com/fijiwebdesign/electron-scope/
In the main process I want to launch the script to debug and set a breakpoint on the first line.
I'm following the tests in Electron for chrome debugger api: https://github.com/electron/electron/blob/702352804239f58e5abcd0b96dbd748b68ab0278/spec/api-debugger-spec.js#L77
My code:
win.webContents.debugger.sendCommand(
'Debugger.setBreakpointByUrl', {
lineNumber: 0,
url: './test.js'
},
function (err, result){
if(err){
console.error('Error:', err)
}
console.log('Breakpoint Result: ', result)
})
Full ref: https://github.com/fijiwebdesign/electron-scope/blob/setBreakpoint/index.js#L51
This logs: Result: { breakpointId: './test.js:0:0', locations: [] }
However, no breakpoint is set. I'm assuming if there were then locations would hold the information.
You can find the branch where I'm trying to set a breakpoint here: https://github.com/fijiwebdesign/electron-scope/tree/setBreakpoint