Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

nested describe produces "it undefined" output #88

Closed
wcamarao opened this Issue Nov 13, 2011 · 10 comments

Comments

Projects
None yet
5 participants
Contributor

wcamarao commented Nov 13, 2011

Running the following spec

describe('root', function () {

  describe('nested', function () {

    it('nested statement', function () {
      expect(1).toBeTruthy();
    });

  });

  it('root statement', function () {
    expect(1).toBeTruthy();
  });

});

Produces the following output

  Started
  ..

  Spec root nested
    it nested statement
  Spec root
    it undefined
    it root statement
  Finished in 0.002 seconds
  2 tests, 2 assertions, 0 failures

Which means it's counting the correct number of specs (2) but it's producing 3 it statements. It seems like the second one "it undefined" is being generated due to the nested describe.

Can someone try to reproduce it?

Thanks
-w

I'm seeing this as well.

Contributor

wcamarao commented Nov 14, 2011

I fixed it in

https://github.com/mhevery/jasmine-node/blob/master/lib/jasmine-node/reporter.js

From line 89, I moved up the following condition of a valid spec.description.

So it was

specResults.items_.forEach(function(spec){
  if (spec.failedCount > 0 && spec.description) {

And now it is

specResults.items_.forEach(function(spec){
  if (spec.description) {
    if (spec.failedCount > 0) {

The new if will close on line 117

When producing the "it ..." output, it now ignores spec instances from specResults.items_ with no description (in this case, describe blocks).

Contributor

wcamarao commented Nov 14, 2011

Opened pull request #89

PS. it only happens on --verbose mode

Contributor

quangv commented Nov 19, 2011

I still get this error...

Was functioncallback@6c52bb54cc9cb531bb4af5d7769b77e63d066ea5 ever pulled in?

0725de3

also what's teamcity?

Contributor

wcamarao commented Nov 19, 2011

It looks like it was overlapped by another commit or it wasn't pulled at all.

Teamcity is a CI server by jetbrains: http://www.jetbrains.com/teamcity

Contributor

wcamarao commented Nov 26, 2011

mhevery, can you recheck it?

Contributor

quangv commented Nov 28, 2011

@functioncallback so you still get the bug like me?

Contributor

wcamarao commented Nov 29, 2011

yeap @quangv

Any updates on that issue?

Contributor

tebriel commented Jan 31, 2013

This does not seem to be an issue anymore. I believe the reporter code has been fixed/refactored/rewritten.
Example output from issue above:

root

  nested
    nested statement
    root statement

@tebriel tebriel closed this Jan 31, 2013

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