dennisbergevin / cypress-plugin-last-failed

A companion Cypress plugin for `cy-grep` that re-runs the last failed test(s).
MIT License
12 stars 2 forks source link

Running npx cypress run is not creating the folder /test-results with the failed tests #13

Open CaiqueCoelho opened 3 weeks ago

CaiqueCoelho commented 3 weeks ago

I'm using Cypress in version "13.15.0" and when I run Cypress with npx cypress run --env grepTags=@TestFail I have some Cypress tests failing but the folder /test-results is not created.

I'm using the tag @TestFail to target some specific tests I know will fail Screenshot 2024-10-11 at 18 28 29

I have also run npx cypress-plugin-last-failed run --e2e --browser electron to see if the plugin installation was fine and I just got:

No previous failed tests detected
Ensure you are in the directory of your cypress config
Try running tests again with cypress run

Could you please help me? I can give you more details if you want

dennisbergevin commented 3 weeks ago

Hi @CaiqueCoelho thanks for reaching out!

An initial question:

Can you check to ensure you've followed the plugin's Installation instructions thoroughly?

The absence of a test-results directory being created may be pointing to missing the collectFailingTests within setupNodeEvents in the config.

CaiqueCoelho commented 2 weeks ago

Hey @dennisbergevin thank you so much for your quick answer and help.

I read all the installation instructions again and looks like everything is fine The file below is my setupNodeEvents exported into a separate file Screenshot 2024-10-13 at 20 29 35

The funny thing is, running in the open Cypress mode the plugin works perfectly, but I see even this way the folder is not created, but I'm not sure if the folder is only created in the run mode

Screenshot 2024-10-13 at 20 46 52 Screenshot 2024-10-13 at 20 47 24

Is there any debug mode I can add to see any logs? I'll try some experiments tomorrow, and if I discover anything new, I'll share the details here. Thank you so much

dennisbergevin commented 2 weeks ago

Hey @CaiqueCoelho, thanks for the reply.

The open mode will not create a test-results directory, as the toggle pertains to filtering failed tests per each spec file respectively.

Without really understanding your setupNodeEvents setup, my overall suggestion for debugging would be to remove or comment out everything in your setupNodeEvents other than the following pieces:

...
    setupNodeEvents(on, config) {
      collectFailingTests(on, config);

      require('@bahmutov/cy-grep/src/plugin')(config);
      return config;
    },
...

Ensure the plugin works as intended from this setup, then, work backward by adding a little more back into your setupNodeEvents and observe the behavior.

Please feel free to reach out with any more questions or concerns, or if you find a solution feel free to share here.