Why does exception within frame get no notification in qUnit?

Viewed 324

I noticed that qUnit doesn't give any notice when an exception happens in a later part of the test. For example, running this in a test():

stop();
function myfun(ed) {
    console.log('resumed');
    start(); //Resume qunit
    ok(1,'entered qunit again');
    ok(ed.getContent()== 'expected content') // < causes exception, no getContent() yet.
}
R.tinymce.onAddEditor.add(myfun)

in an inner iframe on the page will cause an exception (TypeError: ed.getContent is not a function), but nothing in Qunit status area tells this. I see 0 failures.

(R being the inner iframe, using technique here: http://www.mattevanoff.com/2011/01/unit-testing-jquery-w-qunit/) Would I be correct in assuming this isn't the best way to go for testing sequences of UI interaction that cause certain results? Is it always better to use something like selenium, even for some mostly-javascript oriented frontend web-app tests?

As a side note, the Firefox console shows the console.log below the exception here, even though it happened first... why?

1 Answers
Related