cypress-fail-fast icon indicating copy to clipboard operation
cypress-fail-fast copied to clipboard

Run Cypress After Hook For Skipped Spec Files

Open anshap1719 opened this issue 4 years ago • 8 comments

Is your feature request related to a problem? Please describe. When fail fast kicks in, cypress' after hook also gets skipped. This creates an issue with plugins like cypress-terminal-reporter that rely on the hook to output details for debugging.

Describe the solution you'd like

  • Whether or not to run the after hook could be configurable .

anshap1719 avatar Apr 12 '21 16:04 anshap1719

Hi @anshap1719 , could you provide more details about the plugins version, Cypress versions, etc. that you are using?

javierbrea avatar Apr 12 '21 17:04 javierbrea

@javierbrea Sure.

Cypress: 7.0.0 Node: 15.6.0 Fail Fast: ^2.3.1 Terminal Reporter: ^3.0.3

Let me know if I should also create a reproducible example.

anshap1719 avatar Apr 13 '21 06:04 anshap1719

Hi @anshap1719,

This is happening because the plugin relies on the Cypress.runner.stop() method to skip the rest of tests, and this method produces also to skip the after hooks. So, it requires further investigation to find a valid alternative to skip the rest of tests, and it would probably require a refactor of the whole plugin. I have found some alternatives, but they depend too much on Cypress and Mocha internal methods, and may produce a lot of corner cases and issues. Anyway, I will continue investigating.

For the moment, I can see in the cypress-terminal-report documentation that the plugin have an alternative installation method that makes it compatible with this plugin.

Apart of this, maybe enabling/disabling the execution of after hooks using a global configuration wouldn't be enough, because some hooks could be declared inside a block that was totally skipped, and they shouldn't be executed never. So this task maybe requires also a deeper analysis.

By the way, thanks for your feedback! 😃

javierbrea avatar May 30 '21 18:05 javierbrea

Related to https://github.com/archfz/cypress-terminal-report/issues/91

javierbrea avatar May 30 '21 18:05 javierbrea

@javierbrea Actually, they've fixed it on their end now. Thank you for the detailed reason. But I guess the priority of this can be reduced for now unless it's affecting some other commonly used plugin.

anshap1719 avatar May 31 '21 13:05 anshap1719

Hey Any updates on this @javierbrea ?

MoKhajavi75 avatar Jul 05 '23 12:07 MoKhajavi75

Hi @MohamadKh75 , no, there is no progress on this because there is already a solution, as mentioned above.

javierbrea avatar Jul 06 '23 12:07 javierbrea

Hey @javierbrea I'm using @neuralegion/cypress-har-generator and cypress-terminal-report As you mentioned, there is an option in cypress-terminal-report so I can use it with your awesome plugin. But I guess I have some problems with @neuralegion/cypress-har-generator Any ideas?

MoKhajavi75 avatar Jul 13 '23 09:07 MoKhajavi75