kuceb / cypress-plugin-retries

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

fyi - using plugin with typescript support index.ts #70

Open craigryan opened 4 years ago

craigryan commented 4 years ago

We have an nx monorepo with apps/proj-e2e directory. Cypress is set up with plugins/index.js and require('cypress-plugin-retries/lib/plugin')(on) as required. However, the support files were setup with typescript - index.ts, app.po.ts etc. Trying this:

require('cypress-plugin-retries');

Failed when running a single spec (ie: ng run proj-e2e:e2e --spec...) with the error TS2339: Property 'currentTest' does not exist on type 'Cypress & EventEmitter'

To get the plugin to work with both running single specs (headless) and also via the cypress app I made a simple change to import the plugin instead and its all good:

// Import commands.js using ES2015 syntax: import './commands'; import 'cypress-plugin-retries';

hope this helps.