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

RuleTester could use nested describes() for valid vs invalid rules #4907

Closed
platinumazure opened this Issue Jan 10, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@platinumazure
Copy link
Member

platinumazure commented Jan 10, 2016

At present, the RuleTester hierarchy (in mocha) looks like this:

  • describe(rule)
    • it(some valid case)
    • it(some valid case)
    • ...
    • it(some invalid case)
    • it(some invalid case)
    • ...

In other words, valid and invalid cases are all flat, immediately under the rule description. The problem I have with this is I can't immediately tell at a glance which cases are valid and which are invalid. (I know that all invalid ones are after all valid ones, but I don't know where the "line" is in between valid and invalid cases and the cases are not prefixed with valid/invalid.)

I would like to add a level of nesting to make the output a little more readable without adding a ton of noise. My proposed hierarchy is this:

  • describe(rule)
    • describe("valid cases")
      • it(some valid case)
      • it(some valid case)
      • ...
    • describe("invalid cases")
      • it(some invalid case)
      • it(some invalid case)
      • ...

This should be a fairly simple change to rule-tester. Hopefully the unit tests won't be too hard to do either.

EDIT (in response to @eslintbot):

  1. This is more a development problem, it exists in 1.10.3 and master and probably has existed in all versions of ESLint since RuleTester was integrated to the project
  2. Run any rule's tests and view the output
  3. Not a linting issue per se. See above.
  4. See above.
@eslintbot

This comment has been minimized.

Copy link

eslintbot commented Jan 10, 2016

@platinumazure Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@ilyavolodin

This comment has been minimized.

Copy link
Member

ilyavolodin commented Jan 10, 2016

Sure, that sounds fine

@mysticatea

This comment has been minimized.

Copy link
Member

mysticatea commented Jan 11, 2016

👍

ilyavolodin added a commit that referenced this issue Jan 14, 2016

Merge pull request #4946 from eslint/issue4907
Update: Add describe around rule tester blocks (fixes #4907)

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018

@eslint eslint bot added the archived due to age label Feb 6, 2018

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