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

Question - How to fail whole group if one test fails? #45

Open
grigoryevandrey opened this issue Aug 29, 2024 · 1 comment
Open

Question - How to fail whole group if one test fails? #45

grigoryevandrey opened this issue Aug 29, 2024 · 1 comment
Assignees
Labels
Priority: Low Something worth considering, but not a top priority for the team Status: Accepted The proposal or the feature has been accepted for the future versions Type: Enhancement Improving an existing feature

Comments

@grigoryevandrey
Copy link

grigoryevandrey commented Aug 29, 2024

Hello, i've been really enjoying japa.

The documentation states, that

If one of the group fails, it will not impact the other groups.
If one of the test fails, it will not affect other tests.

I would like to know if there is the way to make whole group fail, if one test on the group fails. I need that because i want to create a sequence of tests for CRUD methods.

Now i am using a workaround, writing:

const state = { isErrored: false };

group.each.setup(() => {
  return (hasError) => {
    if (hasError) {
      state.isErrored = true;
    }
  };
});

at the start of group, and then set

.skip(() => state.isErrored)

to every test. However, i just wanna know if there is a better way to do it

@thetutlage
Copy link
Contributor

The entire group is marked as failed. But I think you are looking for a way to skip upcoming tests when one test inside a group fails

@thetutlage thetutlage self-assigned this Aug 30, 2024
@RomainLanz RomainLanz added Type: Enhancement Improving an existing feature Status: Accepted The proposal or the feature has been accepted for the future versions Priority: Low Something worth considering, but not a top priority for the team labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Something worth considering, but not a top priority for the team Status: Accepted The proposal or the feature has been accepted for the future versions Type: Enhancement Improving an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants