cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

Implement `test:after:run` plugin event #27175

Open badeball opened 1 year ago

badeball commented 1 year ago

What would you like?

Similar to https://github.com/cypress-io/cypress/issues/2283, I'd like to propose implementing test:after:run as a plugin event, mirroring the driver event, specifically in the sense that it's invoked for skipped tests and that skipped-status can be detected.

Why is this needed?

I would like this in order to make "pretty output" of @badeball/cypress-cucumber-preprocessor to work better with skipped tests.

As explained in the docs, pretty output doesn't actually originate from the reporter, as reporters in Cypress are limited to Mocha events. Thus, most of pretty output originate from code running in setupNodeEvents() { .. }, IE. a plugin.

The plugin however is not aware of skipped tests (it.skip) and have no way of reporting them the way pretty output works with Cucumber JS, which is what the preprocessor tries to mimic.

Other

No response

badeball commented 1 year ago

Having access to the test's would-be environment variables (shown below) in the proposed hook would also be super useful.

it.skip("should work", { env: { foo: "bar" } });