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

New: rule tests-ordering #53

Open
aladdin-add opened this issue Nov 6, 2017 · 3 comments
Open

New: rule tests-ordering #53

aladdin-add opened this issue Nov 6, 2017 · 3 comments

Comments

@aladdin-add
Copy link
Contributor

aladdin-add commented Nov 6, 2017

if a rule has a very large number of test cases, it would be fine to reorder them based on options.

this rule can enforce code like this to improve readability:

      new RuleTester().run('foo', bar, {
        valid: [

          // valid tests for options: ['foo']
          { code: 'codeA', options: ['foo'] },
          { code: 'codeB', options: ['foo'] },
          // and more...

          // valid tests for options: ['bar']
          { code: 'codeA', options: ['bar'] },
          { code: 'codeB', options: ['bar'] },
          // and more...
        ],
      });
@not-an-aardvark
Copy link
Contributor

How would ordering be determined? For example, does options: ['foo'] come before options: ['foo', 'bar']?

@aladdin-add
Copy link
Contributor Author

it aims to put the tests having same options together, but it's fine to add an option to enforce options ordering alphabetically:

// tests for options: []
...

// tests for options: ['bar']
...

// tests for options: ['bar', 'foo']
...

// tests for options: ['foo']
...

@not-an-aardvark
Copy link
Contributor

Sounds good to me. I don't think it's necessary to make the options alphabetical -- that seems like it could be confusing.

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

No branches or pull requests

2 participants