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

xdescribe executes the code #3630

Closed
3 tasks
uluhonolulu opened this issue Dec 20, 2018 · 4 comments
Closed
3 tasks

xdescribe executes the code #3630

uluhonolulu opened this issue Dec 20, 2018 · 4 comments
Labels
faq a frequently asked question or common misconception invalid not something we need to work on, such as a non-reproducing issue or an external root cause

Comments

@uluhonolulu
Copy link

Prerequisites

  • [ x] Checked that your issue hasn't already been filed by cross-referencing issues with the faq 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. (doesn't apply here)
  • '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 (doesn't apply here)
  • 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. (doesn't apply here)

Description

The code that runs inside an xdescribe block is executed, although it's not supposed to.

Steps to Reproduce

xdescribe('hey', () => {
    console.log("YOOO")
});

Expected behavior:
No console output

Actual behavior:
"YOOO" in the console output

Reproduces how often:
Always

Versions

  • The output of mocha --version and node node_modules/.bin/mocha --version:
    5.2.0
  • The output of node --version:
    v8.11.2
  • The version and architecture of your operating system:
    Windows 7
  • Your shell (bash, zsh, PowerShell, cmd, etc.):
    VSCode terminal
@craigtaub craigtaub added type: bug a defect, confirmed by a maintainer status: waiting for author waiting on response from OP - more information needed labels Dec 20, 2018
@craigtaub
Copy link
Contributor

craigtaub commented Dec 20, 2018

Not quite sure if this is by design or not.
Docs suggest should be executed but I think it might just be incorrect docs.
See .only on https://mochajs.org/#exclusive-tests says "Note: All nested suites will still be executed.". Think the same deal.

@craigtaub craigtaub added unconfirmed-bug and removed type: bug a defect, confirmed by a maintainer labels Dec 20, 2018
@uluhonolulu
Copy link
Author

@craigtaub I couldn't find any docs for xdescribe -- where did you see that "Docs suggest should be executed"?

@craigtaub
Copy link
Contributor

@uluhonolulu sorry i meant "not" executed. xdescribe same as .skip..

@boneskull boneskull added invalid not something we need to work on, such as a non-reproducing issue or an external root cause faq a frequently asked question or common misconception and removed status: waiting for author waiting on response from OP - more information needed unconfirmed-bug labels Jan 2, 2019
@boneskull
Copy link
Contributor

Yes, this is by design. The reasoning is that .skip is not the only way to control which suites / tests are executed. We have --grep, --fgrep and .only, and they all have precedence. The only way to ensure multiple options are respected (though the greplike options are mutually exclusive now) is to execute all suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
faq a frequently asked question or common misconception invalid not something we need to work on, such as a non-reproducing issue or an external root cause
Projects
None yet
Development

No branches or pull requests

3 participants