Skip to content

Multiple describe.skip marks other describes as pending #3184

Closed

Description

Prerequisites

  • Checked that your issue isn't already filed by cross referencing issues with the common mistake label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with:
    node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend avoiding the use of globally installed Mocha.

Description

I ran into something weird while using describe.skip. If I have nested describes, with at least 2 skipped describes inside one, all other describes will be tagged pending.

Steps to Reproduce

First file names 10.test.js:

var assert = require('assert');

describe("Some tests", function(){
  describe("First describe", function(){
    it("should pass", function(){
      assert.equal(1,1)
    })
  })

  describe.skip("Some disabled test");
  describe.skip("Another disabled test");
  describe.skip("One more disabled test");
})

Second file named 20.test.js

var assert = require('assert');

describe("Some other tests", function(){
  describe("a new describe", function(){
    it("should still pass", function(){
      assert.equal(1,1)
    })
  })
})

Results in:



  Some tests
    First describe
      ✓ should pass
    Some disabled test
      Another disabled test
        Some other tests
          a new describe
            - should still pass


  1 passing (5ms)
  1 pending

Note that it is possible to do this with only one file as well:
test.js:

var assert = require('assert');

describe("Some tests", function(){
  describe.skip("Some disabled test");
  describe.skip("Another disabled test");
  describe("First describe", function(){
    it("should pass", function(){
      assert.equal(1,1)
    })
  })
})

Results in:

    Some disabled test
      Another disabled test
        First describe
          - should pass


  0 passing (4ms)
  1 pending


Expected behavior: Only the skipped describes should be marked pending

Actual behavior: All describes after the first two skipped ones will be marked pending.

Reproduces how often: 100%

Versions

  • mocha version: 4.0.1
  • node version: 9.3.0
  • Arch linux
  • zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

status: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions