Skip to content

Commit

Permalink
Don't report filtered tests as pending
Browse files Browse the repository at this point in the history
  • Loading branch information
vancouverwill authored and novemberborn committed Mar 17, 2019
1 parent 99a10a1 commit 23e302a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/run-status.js
Expand Up @@ -59,7 +59,6 @@ class RunStatus extends Emittery {
case 'declared-test':
stats.declaredTests++;
fileStats.declaredTests++;
this.addPendingTest(event);
break;
case 'hook-failed':
stats.failedHooks++;
Expand All @@ -84,6 +83,7 @@ class RunStatus extends Emittery {
} else {
stats.remainingTests++;
fileStats.remainingTests++;
this.addPendingTest(event);
}

break;
Expand Down
15 changes: 15 additions & 0 deletions test/fixture/report/timeoutwithmatch/a.js
@@ -0,0 +1,15 @@
import test from '../../../..';

test('passes needle', t => t.pass());

test.cb('slow needle', t => {
setTimeout(t.end, 15000);
});
test.cb('slow two', t => {
setTimeout(t.end, 15000);
});
test.cb('slow three needle', t => {
setTimeout(t.end, 15000);
});

test('passes two', t => t.pass());
1 change: 1 addition & 0 deletions test/fixture/report/timeoutwithmatch/package.json
@@ -0,0 +1 @@
{}
5 changes: 3 additions & 2 deletions test/helper/report.js
Expand Up @@ -81,7 +81,7 @@ exports.sanitizers = {
version: str => replaceString(str, `v${pkg.version}`, 'v1.0.0-beta.5.1')
};

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

const options = {
Expand All @@ -96,7 +96,7 @@ const run = (type, reporter) => {
require: [],
cacheEnabled: true,
compileEnhancements: true,
match: [],
match,
babelConfig: {testOptions: {}},
resolveTestsFrom: projectDir,
projectDir,
Expand Down Expand Up @@ -144,6 +144,7 @@ exports.failFast2 = reporter => run('failFast2', reporter);
exports.only = reporter => run('only', reporter);
exports.timeoutInSingleFile = reporter => run('timeoutInSingleFile', reporter);
exports.timeoutInMultipleFiles = reporter => run('timeoutInMultipleFiles', reporter);
exports.timeoutWithMatch = reporter => run('timeoutWithMatch', reporter, ['*needle*']);
exports.watch = reporter => run('watch', reporter);
exports.typescript = reporter => run('typescript', reporter);
exports.edgeCases = reporter => run('edge-cases', reporter);
1 change: 1 addition & 0 deletions test/reporters/verbose.js
Expand Up @@ -44,5 +44,6 @@ test('verbose reporter - timeout', t => {

t.test('single file run', run('timeoutInSingleFile'));
t.test('multiple files run', run('timeoutInMultipleFiles'));
t.test('single file with only certain tests matched run', run('timeoutWithMatch'));
t.end();
});
17 changes: 17 additions & 0 deletions test/reporters/verbose.timeoutwithmatch.log
@@ -0,0 +1,17 @@

---tty-stream-chunk-separator
✔ passes needle
---tty-stream-chunk-separator

✖ Timed out while running tests

2 tests were pending in ~/test/fixture/report/timeoutwithmatch/a.js

◌ slow needle
◌ slow three needle

---tty-stream-chunk-separator

1 test passed

---tty-stream-chunk-separator

0 comments on commit 23e302a

Please sign in to comment.