Skip to content

Commit 389ae8e

Browse files
author
Benjamin Thomas
committed
Only enter 'teardown' phase if the test suite gets there. otherwise errors can be reported to happen in the wrong 'phases'
1 parent 1a4e51b commit 389ae8e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

async_testing.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Test.prototype.run = function() {
5454

5555
try {
5656
this.__phase = 'test';
57-
this.__func(this.assert, function() { self.__phase = 'teardown'; self.finish(); }, this);
57+
this.__func(this.assert, function() { self.finish(); }, this);
5858
}
5959
catch(err) {
6060
if( this.listeners('uncaughtException').length > 0 ) {
@@ -67,7 +67,6 @@ Test.prototype.run = function() {
6767

6868
// they didn't ask for the finish function so assume it is synchronous
6969
if( this.__func.length < 2 ) {
70-
this.__phase = 'teardown';
7170
this.finish();
7271
}
7372
};
@@ -299,6 +298,7 @@ TestSuite.prototype.runTest = function(testIndex) {
299298

300299
try {
301300
if(suite._teardown) {
301+
t.__phase = 'teardown';
302302
if( suite._teardown.length == 0 ) {
303303
suite._teardown.call(t);
304304
teardownCallback();

0 commit comments

Comments
 (0)