Skip to content

Show clear indicator in the output when .only() is used #1135

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

Closed
sindresorhus opened this issue Nov 30, 2016 · 7 comments · Fixed by #1177
Closed

Show clear indicator in the output when .only() is used #1135

sindresorhus opened this issue Nov 30, 2016 · 7 comments · Fixed by #1177

Comments

@sindresorhus
Copy link
Member

It's easy to forget and end up not running the rest of the tests before pushing changes.


Similar to #1134.

@tjbenton
Copy link

tjbenton commented Dec 7, 2016

This happened to me yesterday

@sindresorhus
Copy link
Member Author

@tjbenton I would recommend using our ESLint plugin, which would have caught that and many other things.

@ThomasBem
Copy link
Contributor

I have made a PR that fixes #1134 in -> #1160 and since this is kind of similar I would like to take a stab at this too.

@sindresorhus
Copy link
Member Author

@ThomasBem Go for it! 😄

@ThomasBem
Copy link
Contributor

After looking at the code its really easy to get this to print out a warning similar to what was done for the #1134 issue in the #1160 PR.

I was thinking about changing the logic around counting tests when in .only / exclusive mode. I did some quick testing and I could make it at least count all the tests in files that does NOT contain any .only tests.

This would look something like this:

If all test files have at least one .only test in them, it logs this:
''There are tests with the .only() modifier in use. All other tests have been skipped''

If there are additional test files that do not contain any .only tests, it logs this:
"There are tests with the .only() modifier in use. At least', remainingTests, 'tests were not run."

remainingTests would then be the number of tests in the files without exclusive tests in them.

Any thoughts around this?

@mightyiam
Copy link
Contributor

Perhaps instead of
"There are tests with the .only() modifier in use"
be it
"The .only() modifier is used in some tests"

@ThomasBem
Copy link
Contributor

I agree, that wording is much better.

Any thoughts regarding if there is any point to adding additional details around a number of tests skipped?

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

Successfully merging a pull request may close this issue.

4 participants