protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Mocha Skipped Tests aren't Pretty

Open Droogans opened this issue 12 years ago • 4 comments

When running skipped tests in our unit test suite, the output looks like this:

  Unit Tests
      ✗ should get skipped (skipped)
      ✓ should pass

Using the mocha adapter for Protractor, the output looks something like this:

  EndToEnd Tests
      - function (done) {
      this.timeout(0);
      flow.execute(fn).then(seal(done), done);
    }
      ✓ should pass

There is a difference you can't see here. The unit tests' skipped tests are written in gray, whereas the skipped (they're actually labeled "Pending") are light blue.

Droogans avatar Apr 04 '14 19:04 Droogans

You can use this example to replicate the issue.

Droogans avatar Apr 04 '14 20:04 Droogans

+1. The tests come across as "pending" instead of "ignored" which can fail CI tools.

teddyhwang avatar May 24 '14 23:05 teddyhwang

Is this from an older version of mocha? Looking in the mocha docs, I don't see a way to make tests 'skipped', only 'pending'. See http://visionmedia.github.io/mocha/#inclusive-tests, which says "This puts them [the tests] in a pending state"

juliemr avatar Jun 25 '14 20:06 juliemr

This appears to be an issue in mocha, and also one that appears to be fixed (sort of).

I've spent some time commenting out things/changing things around. This definitely isn't affected by the version of protractor. I tried both 0.20.1 and 0.24.2, and there was identical behavior.

Honestly I'm not sure if I've updated my mocha, but I suspect that I did.

What I did was mark a single test as it.skip, and ran that one file through protractor. Mocha simply didn't print that test.

I changed the describe to describe.only, and left the skipped test. Suddenly, it printed this:

Using the selenium server at http://localhost:4444/wd/hub


  Login Page
    ✓ should not log you in with a blank username and password #smoke 
    ✓ should not log you in with a blank username #smoke 
    ✓ should not log you in with a blank password #smoke 
    - should not log you in with invalid credentials #smoke


  3 passing (5s)
  1 pending

I've already filed an issue with mocha about some strangeness with describe.only already.

Looks like this one is on them.

Droogans avatar Jun 25 '14 21:06 Droogans