Displaying the number of pending specs #370

Merged
merged 2 commits into from Apr 11, 2012

Conversation

Projects
None yet
2 participants
Contributor

adomokos commented Apr 10, 2012

I am displaying the number of pending specs at the end of the reporter output.

I also modified the way we print the summary. It now will say 1 test complete instead of 1 tests complete.

This is what you're getting with this pull request:
# of pending tests

Contributor

tj commented Apr 10, 2012

cool looks good :D we must have an issue this can close, I think a few people requested it, I'll comment in the diff

lib/reporters/base.js
@@ -237,6 +237,11 @@ function Base(runner) {
stats.end = new Date;
stats.duration = new Date - stats.start;
});
+
+ runner.on('pending', function(){
+ stats.pendings = stats.pendings || 0;
@tj

tj Apr 10, 2012

Contributor

we shouldn't need this line since it's defined above. I'd probably just called it stats.pending for plural

lib/reporters/base.js
+ return "tests";
+ }
+ }
+
@tj

tj Apr 10, 2012

Contributor

style nitpick, maybe just:

function pluralize(n){
  return 1 == n ? 'test' : 'tests';
}
lib/reporters/base.js
+
+ // pending
+ if (stats.pendings > 0) {
+ fmt = color('pending', ' *')
@tj

tj Apr 10, 2012

Contributor

let's use • instead of *
just because unicode is hawt, or one of the other circular glyphs

lib/reporters/base.js
+ stats.duration);
+
+ // pending
+ if (stats.pendings > 0) {
@tj

tj Apr 10, 2012

Contributor

if (stats.pending) {

Contributor

adomokos commented Apr 10, 2012

I think issue 340 can be closed when this is closed.

Contributor

adomokos commented Apr 11, 2012

Can this pull request be merged into master and closed? Is there anything else I should change there?

tj added a commit that referenced this pull request Apr 11, 2012

Merge pull request #370 from adomokos/add_pending_count
Displaying the number of pending specs

@tj tj merged commit f3eeab1 into mochajs:master Apr 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment