Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple describe.skip marks other describes as pending #3184

Closed
4 tasks done
MCSH opened this issue Dec 28, 2017 · 2 comments
Closed
4 tasks done

Multiple describe.skip marks other describes as pending #3184

MCSH opened this issue Dec 28, 2017 · 2 comments
Assignees
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer

Comments

@MCSH
Copy link

MCSH commented Dec 28, 2017

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
@alisafari1998
Copy link

I get the same result on:
Versions
mocha version: 4.1.0
node version: 9.3.0
Arch linux
zsh

@boneskull boneskull added type: bug a defect, confirmed by a maintainer status: accepting prs Mocha can use your help with this one! labels Jan 2, 2018
@boneskull
Copy link
Contributor

this is likely related to other issues like #2014

@outsideris outsideris self-assigned this Mar 12, 2018
This was referenced Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants