Skip to content

Commit

Permalink
Reword error message for when assertions are used after test has fini…
Browse files Browse the repository at this point in the history
…shed
  • Loading branch information
novemberborn authored and sindresorhus committed Apr 5, 2017
1 parent ecdadfa commit d2a294d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ class Test {

countPassedAssertion() {
if (this.finishing) {
this.saveFirstError(new Error('Assertion passed, but test has already ended'));
this.saveFirstError(new Error('Assertion passed, but test has already finished'));
}

this.assertCount++;
}

addPendingAssertion(promise) {
if (this.finishing) {
this.saveFirstError(new Error('Assertion passed, but test has already ended'));
this.saveFirstError(new Error('Assertion passed, but test has already finished'));
}

this.assertCount++;
Expand All @@ -171,7 +171,7 @@ class Test {

addFailedAssertion(error) {
if (this.finishing) {
this.saveFirstError(new Error('Assertion failed, but test has already ended'));
this.saveFirstError(new Error('Assertion failed, but test has already finished'));
}

this.assertCount++;
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ test('number of assertions matches t.plan when the test exits, but before all pe
result = r;
}).run().then(passed => {
t.is(passed, false);
t.match(result.reason.message, /Assertion passed, but test has already ended/);
t.match(result.reason.message, /Assertion passed, but test has already finished/);
t.is(result.reason.name, 'Error');
t.end();
});
Expand All @@ -610,7 +610,7 @@ test('number of assertions matches t.plan when the test exits, but before all pe
result = r;
}).run().then(passed => {
t.is(passed, false);
t.match(result.reason.message, /Assertion failed, but test has already ended/);
t.match(result.reason.message, /Assertion failed, but test has already finished/);
t.is(result.reason.name, 'Error');
t.end();
});
Expand Down

0 comments on commit d2a294d

Please sign in to comment.