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

Non 0 output for failed tests? (Usage in CI) #28

Closed
mog3n opened this issue Mar 16, 2021 · 4 comments
Closed

Non 0 output for failed tests? (Usage in CI) #28

mog3n opened this issue Mar 16, 2021 · 4 comments

Comments

@mog3n
Copy link

mog3n commented Mar 16, 2021

Hi there,

I am running cypress parallel in CI and was wondering if it's possible to return a non-zero output if one test fails?

Here's the command I'm running: cypress-parallel -s cy:run -t 4 -d 'cypress/integration/v2'

Thank you!

@mog3n mog3n changed the title Non 0 output for failed tests? Non 0 output for failed tests? (Usage in CI) Mar 16, 2021
@jebadirad
Copy link

im facing the same issue. we are using this in CI and just discovered that we have some failing tests that is not causing the pipeline to fail

@mog3n
Copy link
Author

mog3n commented Mar 30, 2021

@jebadirad I was able to create a python script that parses the results-

You want to output the cypress runner results to a file caled results.txt.

Then to parse the results, run this python script:

import sys
f = open('results.txt', 'r')

success = 0
fail = 0

for l in f:
    print(l)
    if "Results" in l:
        line = l.split()
        print(line)
        tests = line[6]
        success = line[8]
        fail = line[10]
        
        if tests == success == fail:
            tests = line[5]
            success = line[7]
            fail = line[9]

print("Tests", tests, "Succeeded:", success, "Failed:", fail)

if tests == success:
    # No failures
    sys.exit(0)
else:
    # There was at least one failure
    sys.exit(69)

@shrohitpatel
Copy link

Hello @jebadirad

Thank you for adding support for a custom reporter. I am facing similar isssue with CI not failing the cypress-parallel task with custom reporter. Looks like the failing cypress task is skipped for custom reporter.

https://github.com/tnicola/cypress-parallel/pull/31/files#diff-347ff93ed2b00c93c817863e32fbac5b4fac71d7339a48378980e682777689f4R209

@tnicola
Copy link
Owner

tnicola commented Dec 4, 2021

Should be implemented in 0.6.0. Feel free to re-open the issue if not working.

@tnicola tnicola closed this as completed Dec 4, 2021
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

No branches or pull requests

4 participants