Skip to content

Commit

Permalink
Test: define the assertCount getter on the prototype instead of wit…
Browse files Browse the repository at this point in the history
…h every new test
  • Loading branch information
jamestalmage committed Jan 21, 2016
1 parent 3762f92 commit 5d80bcd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ function Test(title, fn) {
this.duration = null;
this.assertError = undefined;

Object.defineProperty(this, 'assertCount', {
enumerable: true,
get: function () {
return this.assertions.length;
}
});

// TODO(jamestalmage): make this an optional constructor arg instead of having Runner set it after the fact.
// metadata should just always exist, otherwise it requires a bunch of ugly checks all over the place.
this.metadata = {};
Expand All @@ -53,6 +46,13 @@ function Test(title, fn) {

module.exports = Test;

Object.defineProperty(Test.prototype, 'assertCount', {
enumerable: true,
get: function () {
return this.assertions.length;
}
});

Test.prototype._assert = function (promise) {
this.assertions.push(promise);
};
Expand Down

0 comments on commit 5d80bcd

Please sign in to comment.