currents-dev/cypress-cloud

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

Closed this issue · 1 comments

Before opening, please confirm:

  • I have searched for duplicate or closed issues and discussions.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I acknowledge that I will attach a full debug log, otherwise the issue will be closed with no response.

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

Thanks for reporting and sharing the details @alyssa-glean.
The real issue here is the ongoing issue in cypress runner: cypress-io/cypress#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.