Skip to content

Commit 23e302a

Browse files
vancouverwillnovemberborn
authored andcommitted
Don't report filtered tests as pending
1 parent 99a10a1 commit 23e302a

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

lib/run-status.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class RunStatus extends Emittery {
5959
case 'declared-test':
6060
stats.declaredTests++;
6161
fileStats.declaredTests++;
62-
this.addPendingTest(event);
6362
break;
6463
case 'hook-failed':
6564
stats.failedHooks++;
@@ -84,6 +83,7 @@ class RunStatus extends Emittery {
8483
} else {
8584
stats.remainingTests++;
8685
fileStats.remainingTests++;
86+
this.addPendingTest(event);
8787
}
8888

8989
break;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import test from '../../../..';
2+
3+
test('passes needle', t => t.pass());
4+
5+
test.cb('slow needle', t => {
6+
setTimeout(t.end, 15000);
7+
});
8+
test.cb('slow two', t => {
9+
setTimeout(t.end, 15000);
10+
});
11+
test.cb('slow three needle', t => {
12+
setTimeout(t.end, 15000);
13+
});
14+
15+
test('passes two', t => t.pass());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

test/helper/report.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ exports.sanitizers = {
8181
version: str => replaceString(str, `v${pkg.version}`, 'v1.0.0-beta.5.1')
8282
};
8383

84-
const run = (type, reporter) => {
84+
const run = (type, reporter, match = []) => {
8585
const projectDir = path.join(__dirname, '../fixture/report', type.toLowerCase());
8686

8787
const options = {
@@ -96,7 +96,7 @@ const run = (type, reporter) => {
9696
require: [],
9797
cacheEnabled: true,
9898
compileEnhancements: true,
99-
match: [],
99+
match,
100100
babelConfig: {testOptions: {}},
101101
resolveTestsFrom: projectDir,
102102
projectDir,
@@ -144,6 +144,7 @@ exports.failFast2 = reporter => run('failFast2', reporter);
144144
exports.only = reporter => run('only', reporter);
145145
exports.timeoutInSingleFile = reporter => run('timeoutInSingleFile', reporter);
146146
exports.timeoutInMultipleFiles = reporter => run('timeoutInMultipleFiles', reporter);
147+
exports.timeoutWithMatch = reporter => run('timeoutWithMatch', reporter, ['*needle*']);
147148
exports.watch = reporter => run('watch', reporter);
148149
exports.typescript = reporter => run('typescript', reporter);
149150
exports.edgeCases = reporter => run('edge-cases', reporter);

test/reporters/verbose.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ test('verbose reporter - timeout', t => {
4444

4545
t.test('single file run', run('timeoutInSingleFile'));
4646
t.test('multiple files run', run('timeoutInMultipleFiles'));
47+
t.test('single file with only certain tests matched run', run('timeoutWithMatch'));
4748
t.end();
4849
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
---tty-stream-chunk-separator
3+
✔ passes needle
4+
---tty-stream-chunk-separator
5+

6+
✖ Timed out while running tests
7+
8+
2 tests were pending in ~/test/fixture/report/timeoutwithmatch/a.js
9+
10+
◌ slow needle
11+
◌ slow three needle
12+
13+
---tty-stream-chunk-separator
14+
15+
1 test passed
16+
17+
---tty-stream-chunk-separator

0 commit comments

Comments
 (0)