Skip to content

Commit

Permalink
Make test reset method recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
pineapplemachine committed Mar 28, 2018
1 parent 9fc35c6 commit 5be5d0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion canary.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ class CanaryTest{
this.columnInLine = undefined;
}
}
// Reset the state of the test so that it is safe to run it again.
// Reset the state of the test and all child tests so that it is safe to
// run it again.
reset(){
this.attempted = false;
this.skipped = false;
Expand All @@ -168,6 +169,9 @@ class CanaryTest{
this.startTime = undefined;
this.endTime = undefined;
this.errors = [];
for(let child of this.children){
child.reset();
}
}
// Mark the test and all its children as "TODO". These tests will not be
// attempted.
Expand Down
2 changes: 1 addition & 1 deletion docs/api-advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ Group expansion is put off until tests are actually needed in order to make the

# reset

Resets the test's state so that it is safe to run it again.
Resets the test's state so that it is safe to run it again. This method resets tests recursively, so all tests that belong to a group will also be reset.

**Examples:**

Expand Down

0 comments on commit 5be5d0c

Please sign in to comment.