currents-dev / cypress-cloud

Debug, troubleshoot and record Cypress CI tests in Cloud
https://currents.dev
Other
47 stars 16 forks source link

Advice on how best to avoid clashes between `cloudPlugin` and our own setup? #152

Closed alyssaruth closed 1 year ago

alyssaruth commented 1 year ago

Before opening, please confirm:

Environment information

N / A

Describe the bug

Your documentation suggests to set up cypress-cloud as follows:

// cypress.config.js
const { defineConfig } = require("cypress");
const { cloudPlugin } = require("cypress-cloud/plugin");
module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      return cloudPlugin(on, config);
    },
  },
});

In our case, we had our own logic in setupNodeEvents, so what we've actually ended up with is this:

e2e: {
    specPattern: 'integration/**/*.spec.ts',
    supportFile: 'support/index.ts',
    setupNodeEvents(on, config) {
      setupNodeEvents(on, config) <-- our own thing
      return cloudPlugin(on, config) <-- the cypress-cloud thing
    },
  },

This was working fine, until we recently bumped to 1.8.4 which pulled in this change. Because you now have your own implementation of after:spec, our own one got superceded and some of our own logic just silently stopped running.

I could switch the statements around and apply your config and then ours, but without reading through your implementation I'm not sure if this would work. In general, this feels like a bit of a trap - and some explicit advice about the best way to manage our own config alongside that of cypress-cloud would be appreciated!

We've reverted the version bump for the time being.

Expected behavior

N / A

Command and Setup

N / A

Full log and debug output

N / A

agoldis commented 1 year ago

Thanks for reporting and sharing the details @alyssa-glean. The real issue here is the ongoing issue in cypress runner: https://github.com/cypress-io/cypress/issues/5240

Please take a look at this plugin by @elaichenkov: https://elaichenkov.medium.com/overcoming-cypress-limitations-with-cypress-plugin-init-library-70c8249342be

Please let me know if you had any success with using it - will be happy to assist.