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

Fix “Your test suite must contain at least one test” problem when it/test is used without describe #5

Closed
wants to merge 1 commit into from

Conversation

dtinth
Copy link

@dtinth dtinth commented Oct 5, 2018

If we use test() or it() without putting it in describe block, when this reporter is active, the test will fail with this confusing error message:

Your test suite must contain at least one test

Inspecting further, I found that allure.startCase() will error out if allure.startSuite has not been called before.

To fix this, I changed the notion of suite and case. Now, 1 test file = 1 suite, regardless of describe blocks. The title of each describe block is prepended to each case. This matches the behavior of jest-junit.

…`/`test` is used without `describe`

If we use `test()` or `it()` without putting it in `describe` block,
when this reporter is active, the test will fail with confusing error:

    Your test suite must contain at least one test

Inspecting further,
I found that `allure.startCase()` will error out if `allure.startSuite` is not called before.

To fix this, I changed the notion of `suite` and `case`.
Now, 1 test file = 1 suite, regardless of `describe` blocks.
The title of each `describe` block is prepended to each case.
This matches the behavior of `jest-junit`.
@zaqqaz
Copy link
Owner

zaqqaz commented Mar 1, 2019

Sorry, it's not expected behaviour to me.

@zaqqaz zaqqaz closed this Mar 1, 2019
@dtinth
Copy link
Author

dtinth commented Mar 1, 2019

@zaqqaz Then what is the expected behavior for when a test calls it without a surrounding describing blocks? (In normal Jest, without this plug-in, it works fine.)

In my opinion, maybe an error saying “When using jest-allure, you must surround all your test cases with a describe block” would be more helpful to developers than the current behavior.

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 this pull request may close these issues.

2 participants