mocha.el
mocha.el copied to clipboard
Mocha debug
When launching mocha-debug-XXX with a 'debugger;' statement, the debugger launches, ignores the debugger and the test suite finisches without allowing to debug.
By moving the debug option from node to mocha, the debugger stops nicely on the breakpoint, and it works as expected.
(this issue is perfectly reproducible on the commandline).
What configuration are you using with the debugger? I use it all the time and don't have an issue.
I'll try this patch and see if it works the same for my projects.
Configuration: Mac OSX Emacs-25.1-rc1. But this seems irrelevant as behaviour is identical on the command-line. Node and mocha freshly installed this week.
I have to check the values on my Mac later.
This is a 'known' issue with Mocha and the Chrome V8 engine. I'll find a link. (Muktitasking sucks on an iphone)
I should have been clearer. What node and mocha configuration are you using? What versions of node and mocha, and what string are you using with mocha.el to run them?
Sorry for the delay, I was in Italy on holiday and had to drive back to Belgium and get my stuff back together.
Node: 6.3.1 Mocha: 3.0.2
here is a sample of my terminal.
First with node --debug which runs to completion without stopping, the second with mocha debug which stops on the first statement, then I continue and it breaks on the debugger statement. After continue again it runs through completion.
~/Projects/rvm-backend $ node --debug node_modules/.bin/mocha -r babel-register test/containers-test.js
Debugger listening on [::]:5858
containers service
{"name":"docker","hostname":"mars","pid":35919,"level":30,"msg":"initialize status failed: TypeError: Cannot read property 'Labels' of undefined","time":"2016-08-21T22:37:01.106Z","v":0}
{"name":"status","hostname":"mars","pid":35919,"level":30,"msg":"updating status with {\"status\":\"idle\"}","time":"2016-08-21T22:37:01.106Z","v":0}
{"name":"notifications","hostname":"mars","pid":35919,"level":30,"msg":"sending notification{\"status\":\"idle\"}","time":"2016-08-21T22:37:01.106Z","v":0}
✓ should initialize status to idle if no rvm-active container is running
{"name":"docker","hostname":"mars","pid":35919,"level":30,"msg":"running","time":"2016-08-21T22:37:01.109Z","v":0}
{"name":"status","hostname":"mars","pid":35919,"level":30,"msg":"updating status with {\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:37:01.109Z","v":0}
{"name":"notifications","hostname":"mars","pid":35919,"level":30,"msg":"sending notification{\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:37:01.109Z","v":0}
✓ should update status to running if rvm-active container is running
2 passing (51ms)
~/Projects/rvm-backend $ node node_modules/.bin/mocha debug -r babel-register test/containers-test.js
debug> < Debugger listening on [::]:5858
debug> connecting to 127.0.0.1:5858 ... ok
break in node_modules/mocha/bin/_mocha:7
5 */
6
> 7 var program = require('commander'),
8 path = require('path'),
9 fs = require('fs'),
~/Projects/rvm-backend $ node --debug node_modules/.bin/mocha -r babel-register test/containers-test.js
Debugger listening on [::]:5858
containers service
{"name":"docker","hostname":"mars","pid":35919,"level":30,"msg":"initialize status failed: TypeError: Cannot read property 'Labels' of undefined","time":"2016-08-21T22:37:01.106Z","v":0}
{"name":"status","hostname":"mars","pid":35919,"level":30,"msg":"updating status with {\"status\":\"idle\"}","time":"2016-08-21T22:37:01.106Z","v":0}
{"name":"notifications","hostname":"mars","pid":35919,"level":30,"msg":"sending notification{\"status\":\"idle\"}","time":"2016-08-21T22:37:01.106Z","v":0}
✓ should initialize status to idle if no rvm-active container is running
{"name":"docker","hostname":"mars","pid":35919,"level":30,"msg":"running","time":"2016-08-21T22:37:01.109Z","v":0}
{"name":"status","hostname":"mars","pid":35919,"level":30,"msg":"updating status with {\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:37:01.109Z","v":0}
{"name":"notifications","hostname":"mars","pid":35919,"level":30,"msg":"sending notification{\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:37:01.109Z","v":0}
✓ should update status to running if rvm-active container is running
2 passing (51ms)
~/Projects/rvm-backend $ node node_modules/.bin/mocha debug -r babel-register test/containers-test.js
debug> < Debugger listening on [::]:5858
debug> connecting to 127.0.0.1:5858 ... ok
break in node_modules/mocha/bin/_mocha:7
5 */
6
> 7 var program = require('commander'),
8 path = require('path'),
9 fs = require('fs'),
c
debug>
debug> < containers service
debug> break in test/containers-test.js:59
57 var containers = new _containers2.default(fakeDockerode);
58
>59 debugger;
60
61 var s = containers.initializeStatus().then(function () {
c
< {"name":"docker","hostname":"mars","pid":35934,"level":30,"msg":"initialize status failed: TypeError: Cannot read property 'Labels' of undefined","time":"2016-08-21T22:39:30.220Z","v":0}
debug> < {"name":"status","hostname":"mars","pid":35934,"level":30,"msg":"updating status with {\"status\":\"idle\"}","time":"2016-08-21T22:39:30.221Z","v":0}
debug> < {"name":"notifications","hostname":"mars","pid":35934,"level":30,"msg":"sending notification{\"status\":\"idle\"}","time":"2016-08-21T22:39:30.221Z","v":0}
debug> < ✓ should initialize status to idle if no rvm-active container is running (3927ms)
debug> < {"name":"docker","hostname":"mars","pid":35934,"level":30,"msg":"running","time":"2016-08-21T22:39:30.229Z","v":0}
debug> < {"name":"status","hostname":"mars","pid":35934,"level":30,"msg":"updating status with {\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:39:30.229Z","v":0}
< {"name":"notifications","hostname":"mars","pid":35934,"level":30,"msg":"sending notification{\"status\":\"running\",\"task\":{\"containerId\":\"12345678abcdef\",\"id\":\"active_task_id\"}}","time":"2016-08-21T22:39:30.230Z","v":0}
< ✓ should update status to running if rvm-active container is running
< 2 passing (4s)
debug> program terminated
Thanks, I'm using mocha 2.x in all my codebases. I wonder if that is the issue.
Your change looks good, but I would just like to be able to determine why it works differently and make sure that your change will work with setups like mine.
I'm in the middle of moving across the country, so I likely won't get a chance to look more until next week.
I'll try to make a minimal test project to show the issue if this helps.
On ma 22 aug. 2016 at 18:12, Al Scott [email protected] wrote:
Thanks, I'm using mocha 2.x in all my codebases. I wonder if that is the issue.
Your change looks good, but I would just like to be able to determine why it works differently and make sure that your change will work with setups like mine.
I'm in the middle of moving across the country, so I likely won't get a chance to look more until next week.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/scottaj/mocha.el/pull/37#issuecomment-241464757, or mute the thread https://github.com/notifications/unsubscribe-auth/AACtMZoG9FEFYsA2Pnqy5ouH5iPBbMxyks5qicp4gaJpZM4Jn8ZK .
Hi I'm interested in this. Is there any progress on what may be the couses?
I applied this PR in my branch mocha.el#mocha-debug and am trying to elaborate on it on the side (working on something else at the moment). I opened a wiki with my notes where you could contribute.
I have not had time to investigate this further (right now I'm not really using mocha or emacs in my day-to-day)
It seems like the issue is that the current setup works for mocha 2 and what is in this PR works for mocha 3. Ideally, I'd like it to work for both versions. Maybe it needs to take a configuration option of MOCHA_MAJOR_VERSION or something like that.
If someone could make a minimal test project to demo this on both versions of mocha and see if that is the issue, it would be much appreciated.