kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

ReferenceError: Cypress is not defined when trying to use cypress-run #48

Closed kriegster108 closed 4 years ago

kriegster108 commented 4 years ago

Following the installation instructions accordingly. I am using latest version of cypress and am getting this error"

 ReferenceError: Cypress is not defined
    at Object.<anonymous> (/Users/hunter.krieg/Documents/Git/convergence-desktop/node_modules/cypress-plugin-retries/lib/support.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:880:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
    at Module.load (internal/modules/cjs/loader.js:735:32)
    at Module._load (internal/modules/cjs/loader.js:648:12)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)
    at Module.require (internal/modules/cjs/loader.js:775:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/Users/hunter.krieg/Documents/Git/convergence-desktop/cypress/plugins/index.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:880:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
    at Module.load (internal/modules/cjs/loader.js:735:32)
    at Module._load (internal/modules/cjs/loader.js:648:12)
    at Module._load (electron/js2c/asar.js:717:26)
    at Function.Module._load (electron/js2c/asar.js:717:26)

my current index.js:

require('cypress-plugin-retries');
const cypressTypeScriptPreprocessor = require('./cy-ts-preprocessor');
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
module.exports = on => {
    on('file:preprocessor', cypressTypeScriptPreprocessor)
}
kriegster108 commented 4 years ago

human error sorry.

partikus commented 4 years ago

@kriegster108 what was the issue? I'm having the same issue but no idea what's wrong.

partikus commented 4 years ago

@kriegster108 what was the issue? I'm having the same issue but no idea what's wrong.

nvm, I was trying to import that under cyperss/plugins/index.js where Cypress is not initialized yet