4

My question is how can one put breakpoints in functional tests? Is it possible in Intern? I'm running the testcases locally on WebDriver, and having 'debugger;' breakpoints will ease my testcase development.

execute(function () { debugger; }) should run in browser and act on 'debugger;' in it, but it doesn't stop the execution...

stafamus
  • 509
  • 2
  • 9
  • node-inspector is the answer here. thanks to neekfenwick on #dojo/freenode. `sudo npm install -g node-inspector` then run it standalone: `node-inspector --web-port=1234`, then run your Intern runner with `--debug-brk` option. Intern runner will pause and you can go step by step at http://127.0.0.1:1234/debug?port=5858 – stafamus Apr 09 '14 at 11:15

1 Answers1

2

I have this working. I start up a few terminals, start my selenium server jar in one, do node-inspector in another, and then fire up that url in chrome. I refresh the chrome window, then put node --debug-brk , and you will see the debugger catch, hit play - and it will go through to your debugger point. I also use the leaveRemoteOpen flag at the end of the command, which will leave the browser window open. my command looks like this:

node --debug-brk node_modules/intern/bin/intern-runner config=public/js/dojo/tt/tests/intern-config.js leaveRemoteOpen

also, in your config youll need this: excludeInstrumentation: /.*/ otherwise it munges your code.

httpete
  • 2,765
  • 26
  • 34
  • 2
    For the copy&paste people: there is a typo in this answer. The parameter passed to node should be "--debug-brk" not "--debeg-brk" (only one character change, I cannot edit this answer......) – Allen Zhang Jan 22 '15 at 05:52