nils-hoyer / cypress-fail-on-console-error

tail cypress test on console error
MIT License
41 stars 8 forks source link

The fail report contains the excluded errors #38

Closed abdennour001 closed 2 years ago

nils-hoyer commented 2 years ago

hey @abdennour001, can you please provide a scenario / repo with equivalent data, so I can have a look into.

abdennour001 commented 2 years ago

Ok, let's say that you ignored the following errors: A, B, and C, it is obvious that if we have one of those errors, the test won't fail, we agree on that. Now, imagine we have this sequence of errors in a test: A -> B -> D, knowing that both A and B are excluded and D is not, so the test will fail because of D, yes? but in the fail report, we got all A, B, and D errors and I think this is wrong

Here is my case: in this case, I excluded the errors started with Open Relay, but I still find them on fail report once the test fails because of another not excluded error. image

nils-hoyer commented 2 years ago

Hi @abdennour001. Thank you for reporting this! I now had some time to investigate.

spies (on console.error) and asserts are handled by Sinon and SinonChai library. Unfortunately Sinon/SinonChai does not offer a filter function for spy calls which fits the implementation of the plugin afaik. Ref: https://www.chaijs.com/plugins/sinon-chai/

As a result of that I didn't find a proper solution within the given time box having for this project. Since this project is fully open to the community, feel free to develop a solution and create PR passing all test requirements.

assertion: https://github.com/nils-hoyer/cypress-fail-on-console-error/blob/main/src/index.ts#L34

spy: https://github.com/nils-hoyer/cypress-fail-on-console-error/blob/main/src/index.ts#L98

nils-hoyer commented 2 years ago

Hi @abdennour001, the issue is fixed. The plugin will now only report the error message causing the cypress test to fail. Please let me know if you notice unexpected behavior.

fixed with version 3.0.0: https://github.com/nils-hoyer/cypress-fail-on-console-error/releases/tag/3.0.0

abdennour001 commented 2 years ago

Great! Thank you very much.

Le mar. 7 juin 2022 à 22:36, nils-hoyer @.***> a écrit :

Hi @abdennour001 https://github.com/abdennour001, the issue is fixed. The plugin will now only report the error message causing the cypress test to fail. Please let me know if you notice unexpected behavior.

fixed with version 3.0.0:

https://github.com/nils-hoyer/cypress-fail-on-console-error/releases/tag/3.0.0

— Reply to this email directly, view it on GitHub https://github.com/nils-hoyer/cypress-fail-on-console-error/issues/38#issuecomment-1149192916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETK63AWFRVOVOI7QBGGEFTVN66FXANCNFSM5LV5SK4Q . You are receiving this because you were mentioned.Message ID: @.***>