node-theseus
node-theseus copied to clipboard
'Invalid Software Version' error when running Mocha

Seeing an 'Invalid Software Version' error when running node-theseus on Mocha. This error does not occur when running node-theseus on other applications.
Repro steps:
1.) Install and run Brackets Sprint 26
2.) Install Theseus using: https://s3.amazonaws.com/theseus-downloads/theseus-0.3.0.zip
3.) Install node v0.10.12
4.) npm install -g node-theseus
5.) npm install -g mocha
6.) Grab mocha executable path using which mocha
7.) node-theseus ~/.nvm/v0.10.12/bin/mocha theseus-verbose=2
8.) Switch to Brackets and view error. No results are displayed.
The output for node-theseus in verbose mode is:
[node-theseus] adding require() instrumentation hook
[node-theseus] listening for WebSocket connections on port 8888
[node-theseus] excluding node_module ~/.nvm/v0.10.12/lib/node_modules/mocha/bin/mocha
[node-theseus] debugger connected
[node-theseus] received debugger message: {"name":"version","arguments":[],"id":0}
[node-theseus] sending debugger message: { id: 0 }
[node-theseus] received debugger message: {"name":"trackExceptions","arguments":[],"id":1}
[node-theseus] sending debugger message: { id: 1 }
[node-theseus] received debugger message: {"name":"trackLogs","arguments":[{"ids":[],"logs":true}],"id":2}
[node-theseus] sending debugger message: { id: 2 }
[node-theseus] received debugger message: {"name":"trackEpochs","arguments":[],"id":3}
[node-theseus] sending debugger message: { id: 3 }
[node-theseus] received debugger message: {"name":"trackHits","arguments":[],"id":4}
[node-theseus] sending debugger message: { id: 4 }
[node-theseus] received debugger message: {"name":"trackExceptions","arguments":[],"id":5}
[node-theseus] sending debugger message: { id: 5 }
[node-theseus] received debugger message: {"name":"trackNodes","arguments":[],"id":6}
[node-theseus] sending debugger message: { id: 6 }
[node-theseus] received debugger message: {"name":"newExceptions","arguments":[null],"id":7}
[node-theseus] sending debugger message: { id: 7 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":8}
[node-theseus] sending debugger message: { id: 8 }
0 passing (1 ms)
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":9}
[node-theseus] sending debugger message: { id: 9 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":10}
[node-theseus] sending debugger message: { id: 10 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":11}
[node-theseus] sending debugger message: { id: 11 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":12}
[node-theseus] sending debugger message: { id: 12 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":13}
[node-theseus] sending debugger message: { id: 13 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":14}
[node-theseus] sending debugger message: { id: 14 }
[node-theseus] received debugger message: {"name":"epochDelta","arguments":[null],"id":15}
...
The 0 passing (1 ms) is a console.log from Mocha.
Running node-theseus with the --theseus-include-modules seems to fix Brackets throwing up that error; however, a new issue has emerged since my mocha tests don't seem to be instrumented / reporting in Brackets...
In any case, going to leave this issue open since the versions of Theseus and node-theseus are up to date / compatible and the shown error is misleading.
Still going through my inbox after coming back from vacation. :) I'm checking this out now.
Thanks for reporting this!
Bug 1: If no files ending in .js are ever require'd, tracer is never initialized, calls to tracer.version() throw an exception, and Theseus reports that the version is wrong. I'll fix this soon-ish.
Bug 2: If new instances of node are spawned with child_process, they don't get instrumented. mocha does this; it's just a wrapper for _mocha, which it so happens you can invoke directly with node-theseus _mocha. Fixing this has ramifications all the way up and down the Theseus stack, so it won't be fixed for a while, but for now just use _mocha.
Bug 3: If a script calls process.exit(), the process exits and you can't debug it. _mocha does this when the tests finish. Fixing this is as simple as process.exit = function () { }. As a work-around, you can add that to the top of node-theseus today, though I'll add it myself soon-ish.
Thanks so much for the detailed reply and workarounds!
Sorry, will leave this open until the fixes are in place.