Permalink
Browse files

Errors are now dumped to the firebug console if available (taken from…

… QUnit)
  • Loading branch information...
1 parent b289816 commit a55543e8c2a5adcf1b9b5c1eefffbf67006896fd @choan choan committed Nov 18, 2008
Showing with 7 additions and 2 deletions.
  1. +6 −1 src/test_case.js
  2. +1 −1 test/unit/test_case_test.html
View
@@ -85,8 +85,13 @@ JsUnitTest.Unit.Testcase.prototype.info = function(message) {
JsUnitTest.Unit.Testcase.prototype.error = function(error, test) {
this.errors++;
- this.actions['retry with throw'] = function() { test.run(true) };
+ this.actions['retry with throw'] = function() { test.run(true); };
this.messages.push(error.name + ": "+ error.message + "(" + JsUnitTest.inspect(error) + ")");
+ if( typeof console != "undefined" && console.error && console.warn && console.info) {
+ console.error("Test '" + test.name.replace(/^\s+/), ''.replace(/\s+$/, '') + "' died, exception and test follows");
+ console.info(error);
+ console.warn(test.test.toString());
+ }
};
JsUnitTest.Unit.Testcase.prototype.status = function() {
@@ -83,7 +83,7 @@ <h1>JavaScript unit test file</h1>
// Error
testError: function() { with(this) {
- testcase.error({name: "name", message: "An Error"});
+ testcase.error({name: "name", message: "An Error"}, this);
assertEqual(0, testcase.assertions, "Assertions");
assertEqual(1, testcase.errors, "Errors");
assertEqual("name: An Error([object Object])", testcase.messages[0], 'Should be equal');

0 comments on commit a55543e

Please sign in to comment.