I've been experimenting with this for some time and though I'm yet to come up with anything that I'm happy with, I'm definitely more happy with the solutions I have, compared to running jasmine-node in an outside terminal. So I'm sharing them here for the community benefit, and maybe to get some ideas and help on implementing this using a more solid technology.
Current Working Implementation
A set of instructions for those who want to quickly get started:
You will need any linux with perl for the file search. I'm on osx and I don't know how this would work on windows.
1. Download this gist: https://gist.github.com/2793871 I'll refer to it as jas-idea.js
2. .. to anywhere require('jasmine-node') and require('underscore') would work.
3. Set up a NodeJS debug configuration using the following parameters:
Path to node: path to nodejs executable
Working directory: /path/to/your/project
Path to Node App JS File: /path/to/jas-idea.js
Application Parameters: ./path/to/spec/folder/or/file --autotest
Now launch a debug session and watch your changed specs re-run while triggering breakpoints and displaying clickable failures and exceptions.
--autotest is optional, so are other, original options. Feedback is appreciated.
Caveats and unresolved issues
- I've encountered problems debugging in this way some parts of code containing child_process.exec, having the process exit with a malloc error.
- Each test run clears require.cache but many things remain in memory, for example any file system watches, and the debug session could easily get bloated, needing to be stopped and restarted.
A non-working alternative prototype
The version posted works by clearing require.cache after each test run, but its better to run a separate child process to clear everything, as does the original jasmine-node autotest.js. I have another implementation of jasmine auto test, but, I can't figure out how to connect a new child process to a running remote NodeJS debug configuration. It seems that the process needs to be launched first with the --debug-brk option specified, followed by launching the debug session, but with programmatic launching of processes the opposite order is needed. So if you know anything about this and can help, it could provide for a better system.
Happy bug hunting!