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

Rule proposal: consistent order of tests #35

Open
lo1tuma opened this issue Sep 13, 2015 · 2 comments
Open

Rule proposal: consistent order of tests #35

lo1tuma opened this issue Sep 13, 2015 · 2 comments
Labels

Comments

@lo1tuma
Copy link
Owner

lo1tuma commented Sep 13, 2015

The spec reporter from Mocha always outputs the test results of the current describe block before the results of subsequent describe blocks.

I would like to have a rule to reflect the same order in the code:

  • describe
    • before / after hooks
    • it
    • it
    • describe

This would be an invalid order:

  • describe
    • before / after hooks
    • describe
    • it

Maybe we should consider a separate rule that requires the position of before /after hooks on top of a describe block.

@willclarktech
Copy link

This would be great. I'd also like this or another rule to enforce order of different types of hooks. E.g.:

Valid order:

  • describe
    • before
    • after
    • beforeEach
    • afterEach

Valid with configuration:

  • describe
    • before
    • beforeEach
    • afterEach
    • after

Invalid order:

  • describe
    • after
    • beforeEach
    • before
    • afterEach

@oprogramador
Copy link

I opened an issue about that separate rule as #193

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

No branches or pull requests

3 participants