Skip to content

Commit d2a294d

Browse files
novemberbornsindresorhus
authored andcommitted
Reword error message for when assertions are used after test has finished
1 parent ecdadfa commit d2a294d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ class Test {
154154

155155
countPassedAssertion() {
156156
if (this.finishing) {
157-
this.saveFirstError(new Error('Assertion passed, but test has already ended'));
157+
this.saveFirstError(new Error('Assertion passed, but test has already finished'));
158158
}
159159

160160
this.assertCount++;
161161
}
162162

163163
addPendingAssertion(promise) {
164164
if (this.finishing) {
165-
this.saveFirstError(new Error('Assertion passed, but test has already ended'));
165+
this.saveFirstError(new Error('Assertion passed, but test has already finished'));
166166
}
167167

168168
this.assertCount++;
@@ -171,7 +171,7 @@ class Test {
171171

172172
addFailedAssertion(error) {
173173
if (this.finishing) {
174-
this.saveFirstError(new Error('Assertion failed, but test has already ended'));
174+
this.saveFirstError(new Error('Assertion failed, but test has already finished'));
175175
}
176176

177177
this.assertCount++;

test/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ test('number of assertions matches t.plan when the test exits, but before all pe
591591
result = r;
592592
}).run().then(passed => {
593593
t.is(passed, false);
594-
t.match(result.reason.message, /Assertion passed, but test has already ended/);
594+
t.match(result.reason.message, /Assertion passed, but test has already finished/);
595595
t.is(result.reason.name, 'Error');
596596
t.end();
597597
});
@@ -610,7 +610,7 @@ test('number of assertions matches t.plan when the test exits, but before all pe
610610
result = r;
611611
}).run().then(passed => {
612612
t.is(passed, false);
613-
t.match(result.reason.message, /Assertion failed, but test has already ended/);
613+
t.match(result.reason.message, /Assertion failed, but test has already finished/);
614614
t.is(result.reason.name, 'Error');
615615
t.end();
616616
});

0 commit comments

Comments
 (0)