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

Mocha strange behavior with adding/remove only statement while using watch flag #3108

Closed
rickarubio opened this issue Nov 15, 2017 · 3 comments

Comments

@rickarubio
Copy link

Mocha version: v3.5.3

I have the following in my package.json:

    "test:watch": "NODE_ENV=test mocha --watch --watch-extensions js,jsx --reporter nyan",

When I run this, everything seems to be running well and fine at first.

However, the problem manifests itself when I start playing around with adding ".only" to my describe blocks.

I'll do something like this on a describe block with 1 it block that is already passing:

describe.only('#blah', () => ....blah....

and all is well. The spec reporter will report 1 spec passing. So far, looking good.

Now, I go ahead and remove the only statement:

describe('#blah', () => ....blah....

The spec reporter reports 0 passing (in green).

At this point, none of the changes I make to any spec files will be picked up anymore.

I either have to avoid use of only, or be very careful about when I add/remove the only statement when using the watch flag.

Anyone else experiencing this?

@ScottFreeCode
Copy link
Contributor

ScottFreeCode commented Nov 15, 2017

This was a known issue in Mocha 3 (duplicate of #2429), which should be fixed in version 4 (the current version) with #2544.

@rickarubio
Copy link
Author

@ScottFreeCode awesome, thanks!

@ScottFreeCode
Copy link
Contributor

You're welcome! Let us know if you need any help transitioning to version 4!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants