Main backend for atom-wannabe module.
WORK IN PROGRESS
Extractorin order to extract all lines of a specific test.
- Run mocha on the specified test and break on the first line.
- Enable breakpoints for all exceptions.
- Set breakpoints for all lines retrieved with the
- Continue to the next breakpoint (or exception break) and save the context in a map until that mocha is terminated.
The runner is async, the frames are sent to the client by the event emitter.
script: script to run with mocha (depends of
data: the content of the script (can be
funcName: name of the functions to inspect (for example,
extractFrom: a line number or a regex pattern for a mocha test name
If a content is passed with
data, then only the parent directory of
is used. Because mocha is not able to run a test provided by a buffer,
it's necessary to write a file. Then the parent directory is the destination
of the temporary file. The new file is prefixed by
.wannabe-. It's removed
as soon as the runner is disposed.
It can a bit annoying because the file is seen ba the atom treeview.
run () and
runner () return a promise (watt) or it can be
used with a callback.
File (test for mocha):
'use strict';const watt = ;const Wannabe = ;const runTests =;;;
frames argument is an object where the keys are the lines and the value
is an array of locals.
- It's not very fast because it relies on the node debugger (which adds a major overhead). But for standard test files it works fine.
- Babel is not really supported. A commented code exists in the
mocha.jsscript file of this project in order to enable the support. It's just a test and it doesn't work very well. The major limitation is that babel is very slow in this case. If you want to write code where babel is mandatory, don't use wannabe.