jeudi 22 janvier 2015

How to debug ember-cli tests running in phantomjs

Context: I have an acceptance test for my ember-cli application, and the test passes just fine in Chrome. However, in phantomjs, my test fails -- the UI doesn't get created the same way, and I'm trying to work out why (I suspect ajax incompatibilities, but that's a different question)


In Chrome, I can use the standard debugging tools on my tests and all is well -- but in phantomjs, I can't get at it with a debugger. I also don't see console.log() messages show up in the output -- all I get is a list of test results in my terminal window.


I can sort-of get diagnostic info by writing things like



equal(true, false, "This is a log message");


and then I get the message as details for the assertion that failed, or I can try and work out what's in the DOM with



equal(true, false, document.getElementsByClassName("my-class".innerHTML);


but both of those a:stop the test going any further, and b:only let me log information from the test itself, not my application.


Is there a way to run my tests outside of "ember test", or some way to attach to the running test processes? Alternatively, is there a way to get console.log() messages to show up in the output?





Aucun commentaire:

Enregistrer un commentaire