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

Disallow the use of `only` in mocha tests #988

Closed
owennicol opened this issue Sep 18, 2017 · 8 comments

Comments

@owennicol
Copy link

commented Sep 18, 2017

Could we add in a rule for not allowing only in mocha tests please?

This is an ESLint plugin for the same thing if that helps: https://www.npmjs.com/package/eslint-plugin-mocha-no-only

@LinusU

This comment has been minimized.

Copy link
Member

commented Sep 18, 2017

Would personally love this, too easy to accidentally commit this 😄

@Flet

This comment has been minimized.

Copy link
Member

commented Sep 18, 2017

This is neat! However, I'd be a little worried that this could open the door to adding lots of framework/library specific rules, which could get hairy.

@LinusU

This comment has been minimized.

Copy link
Member

commented Sep 18, 2017

Yeah, that is very true, might be a good idea to think about where to draw the line, and this could potentially be on the wrong side of that line :)

Although mocha is very widely used...

@ematipico

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2017

.only is also support by Jest and AVA

@dcousens

This comment has been minimized.

Copy link
Member

commented Sep 25, 2017

Useful, but I don't know if this should be standard's responsibility...

@blgm

This comment has been minimized.

Copy link

commented Oct 12, 2017

The best way that I've found to avoid committing .onlys is to use code coverage measurement and enforcement. Then if you accidentally try and commit a .only the CI will fail.

Jasmine uses xit instead of .only and it would be odd to add checks for Mocha but not Jasmine.

@feross

This comment has been minimized.

Copy link
Member

commented May 3, 2018

I don't think this belongs in standard at this time. I have an idea that might accommodate additional rules for particular frameworks and I'd like to re-examine this rule if/when that becomes a thing.

@feross feross closed this May 3, 2018

@Janpot

This comment has been minimized.

Copy link

commented May 4, 2018

If I recall correctly, mocha has a --forbid-only flag. I think this is the right place for this functionality, not in standard.

@feross feross added enhancement and removed enhancement labels May 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
8 participants
You can’t perform that action at this time.