tnicola / cypress-parallel

Reduce up to 40% your Cypress suite execution time parallelizing the test run on the same machine.
MIT License
560 stars 117 forks source link

Question : Does mochawesome .json not come for parallel runs facing issue , getting an issue in after events (facing this issue in 0.11.0) #153

Open Infurnia-Nitin-Upadhyaya opened 1 year ago

bdimitrovski commented 1 year ago

Same here, getting:

An error was thrown in your plugins file while executing the handler for the after:run event.

The error we received was:

Error: Pattern /Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/cypress/reports/html/.jsons/*.json matched no report files
    at /Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/mochawesome-merge/lib/index.js:14:11
    at Array.map (<anonymous>)
    at /Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/mochawesome-merge/lib/utils.js:3:46
    at merge (/Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/mochawesome-merge/lib/index.js:82:17)
    at mergeAndCreate (/Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/cypress-mochawesome-reporter/lib/generateReport.js:12:24)
    at generateReport (/Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/cypress-mochawesome-reporter/lib/generateReport.js:56:20)
    at afterRunHook (/Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/cypress-mochawesome-reporter/lib/index.js:35:9)
    at Object.handler (/Users/bojandimitrovski/Projects/top/top-web/scripts/tests/cypress/node_modules/cypress-mochawesome-reporter/plugin.js:9:11)
    at invoke (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:183:18)
    at /Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:59:14
    at tryCatcher (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/method.js:39:29)
    at Object.wrapChildPromise (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:58:23)
    at RunPlugins.execute (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:164:21)
    at EventEmitter.<anonymous> (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:56:12)
    at EventEmitter.emit (node:events:527:28)
    at EventEmitter.emit (node:domain:475:12)
    at process.<anonymous> (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:527:28)
    at process.emit (node:domain:475:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Users/bojandimitrovski/Library/Caches/Cypress/12.9.0/Cypress.app/Contents/Resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
    at emit (node:internal/child_process:938:14)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

whenever I want to run test in parallel, configured my script in package.json like:

"tests:parallel": "cypress-parallel -s test -m false -t 2 -d 'cypress/e2e/*.spec.ts'"
alanschiobairesdev commented 3 months ago

still an issue, happening to me also

IgorHorta commented 2 months ago

seems like my 'cypress-mochawesome-reporter' was causing some conflicts issues .. with their default "cypress-multi-reporters"

this in cypress.config.ts

fixed for me:

setupNodeEvents(on, config) {
      // eslint-disable-next-line @typescript-eslint/no-var-requires
      if (config?.reporter === 'cypress-mochawesome-reporter') {
        // eslint-disable-next-line @typescript-eslint/no-var-requires
        require('cypress-mochawesome-reporter/plugin')(on)
      }
    },