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

Writing to file doesn't fully work with cypress-fail-fast #91

Closed
anshap1719 opened this issue Apr 12, 2021 · 7 comments
Closed

Writing to file doesn't fully work with cypress-fail-fast #91

anshap1719 opened this issue Apr 12, 2021 · 7 comments
Labels
bug Something isn't working requires-cypress-change

Comments

@anshap1719
Copy link

Hello,

We have a custom parallel running setup using Cypress' Module API and custom node script that takes care of launching parallel instances and combining and generating reports at the end. Although the error described below is reproducible even without parallel builds.

Current behaviour

When using cypress-fail-fast, if one of the it blocks fail in a spec file, the rest are skipped. The spec output log file isn't being generated in this particular case. It only gets generated if either fail fast is disabled or the spec file has only 1 it block or the error is in last it block (so that no other it block from same spec file gets skipped).

Expected behaviour

The log files should be created whether or not tests are being skipped if at least one of the it blocks ran in a spec file.

Plugin config

    require('cypress-terminal-report/src/installLogsPrinter')(on, {
        printLogsToConsole: process.env.NO_LOGS === '1' ? 'never' : 'onFail',
        printLogsToFile: 'always',
        outputRoot: path.resolve(__dirname, '..', 'logs'),
        specRoot: path.relative(config.fileServerFolder, config.integrationFolder),
        outputTarget: {
            '.|json': 'json',
        }
    });

I don't know of a way to modify this behaviour, and collectTestLogs doesn't fit our use case as we attach the files to our Jenkins artifacts.

Is there a way to solve this without using collectTestLogs?

@archfz
Copy link
Owner

archfz commented Apr 12, 2021

Well currently we output to files in an after hook so need to see why that hook doesn't execute in this case.

@archfz archfz added the bug Something isn't working label Apr 12, 2021
@anshap1719
Copy link
Author

Thanks for the quick reply. I'll see if fail fast has any such configuration as well then.

@anshap1719
Copy link
Author

@archfz So it turns out, cypress-fail-fast skips the tests using the before hook. Which could explain why the after hook doesn't run. And this is not configurable, so maybe it's an issue with that plugin instead of this one. If you feel the same, feel free to close the issue.

@archfz
Copy link
Owner

archfz commented Apr 12, 2021

Yeah its an issue on our side. Contribution is welcome.

@anshap1719
Copy link
Author

@archfz I think the best way forward with this is to wait for cypress' new hooks ("after:spec") to be out of experimental events and use it instead.

archfz added a commit that referenced this issue May 17, 2021
#91: Introduce support of logging to files for cypress fail fast.
@archfz
Copy link
Owner

archfz commented May 17, 2021

Support introduced in 3.2.0. Read changelog to see how to enable.

@archfz archfz closed this as completed May 17, 2021
@anshap1719
Copy link
Author

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires-cypress-change
Projects
None yet
Development

No branches or pull requests

2 participants