Krupal Vaghasiya
Krupal Vaghasiya

Reputation: 550

Can not able to run single file in cypress

I have a 5 .js file under the integration folder and want to run single .js file in cypress. but error thrown like:

The following validation error was thrown by your plugins file (C:\Users\admin\LegrandRX\cypress\plugins\index.js). Error: The before:run event requires the experimentalRunEvents flag to be enabled. To enable it, set "experimentalRunEvents": true in your cypress.json

I have set script: { "cy:run": "cypress run"} and I have also tried "experimentalRunEvents": true in cypress.json according to error but nothing to successed

Cypress.json file added from comment:

{
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/reports",
    "charts": true,
    "overwrite": false,
    "html": false,
    "json": true,
    "reportPageTitle": "My Test Suite",
    "embeddedScreenshots": true,
    "inlineAssets": true,
    "experimentalRunEvents": true
  },
  "video": false
}

Upvotes: 0

Views: 407

Answers (1)

Alapan Das
Alapan Das

Reputation: 18634

Please add "experimentalRunEvents":true outside the reporterOptions

{
  "reporter": "cypress-mochawesome-reporter",
  "reporterOptions": {
    "reportDir": "cypress/reports",
    "charts": true,
    "overwrite": false,
    "html": false,
    "json": true,
    "reportPageTitle": "My Test Suite",
    "embeddedScreenshots": true,
    "inlineAssets": true
  },
  "experimentalRunEvents": true,
  "video": false
}

To run a single spec file you can use the command:

cypress run --spec "cypress/integration/examples/actions.spec.js"

Upvotes: 1

Related Questions