cypress: after:run isn't triggered when closing the project after `cypress open`

Current behavior

It looks like after:run never triggers.

module.exports = async (on: any, config: { env: { awsConfig: any } }) => {
  // AWS config
  config.env.awsConfig = awsconfig

  on('after:run', () => {
    console.log('cleaning')
    clean()
  })
}

I’m not sure how it’s supposed to function, the docs say it should trigger after closing the project (after cypress open), but it doesn’t do that.

Maybe these docs are incomplete? It also looks like there’s at least a typo here: “You can return a promise from the after:run event handler and it will be awaited before Cypress proceeds running your specs.” (I’m sure that means to say after?)

Desired behavior

This trigger to be called.

Test code to reproduce

See my above piece of code.

Cypress Version

8.0.0

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Ran into this as well. It is causing issues with data cleanup.

Same as everyone else, want to tear some data down post-run but can’t 😕 If anyone has a workaround, please post it up 🙏