Permalink
Browse files

Only enter 'teardown' phase if the test suite gets there. otherwise e…

…rrors can be reported to happen in the wrong 'phases'
  • Loading branch information...
1 parent 1a4e51b commit 389ae8e4747dc83ae3ef51e062a5e820fd1e1592 Benjamin Thomas committed Mar 18, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 async_testing.js
View
@@ -54,7 +54,7 @@ Test.prototype.run = function() {
try {
this.__phase = 'test';
- this.__func(this.assert, function() { self.__phase = 'teardown'; self.finish(); }, this);
+ this.__func(this.assert, function() { self.finish(); }, this);
}
catch(err) {
if( this.listeners('uncaughtException').length > 0 ) {
@@ -67,7 +67,6 @@ Test.prototype.run = function() {
// they didn't ask for the finish function so assume it is synchronous
if( this.__func.length < 2 ) {
- this.__phase = 'teardown';
this.finish();
}
};
@@ -299,6 +298,7 @@ TestSuite.prototype.runTest = function(testIndex) {
try {
if(suite._teardown) {
+ t.__phase = 'teardown';
if( suite._teardown.length == 0 ) {
suite._teardown.call(t);
teardownCallback();

0 comments on commit 389ae8e

Please sign in to comment.