allure-js icon indicating copy to clipboard operation
allure-js copied to clipboard

[allure-cypress] cy.task('allureReportTest') causing some test flakiness

Open RobertBattaglia opened this issue 1 year ago • 2 comments

Describe the bug

To Reproduce Tough to reproduce, seems a race condition. Stack trace:

From Node.js Internals:
  TypeError: Cannot read properties of undefined (reading 'stage')
      at allureReportTest (/builds/redadcted/npm/src/main/npm/node_modules/allure-cypress/dist/reporter.js:3358:38)
      at invoke (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:248:16)
      at <unknown> (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:59:14)
      at tryCatcher (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)
      at Function.Promise.attempt.Promise.try (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/bluebird/js/release/method.js:39:29)
      at Object.wrapChildPromise (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:58:23)
      at RunPlugins.taskExecute (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:254:10)
      at RunPlugins.execute (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:166:21)
      at EventEmitter.<anonymous> (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:56:12)
      at EventEmitter.emit (node:events:517:28)
      at EventEmitter.emit (node:domain:489:12)
      at process.<anonymous> (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:33:22)
      at process.emit (node:events:517:28)
      at process.emit (node:domain:489:12)
      at process.emit.sharedData.processEmitHook.installedValue [as emit] (/builds/redadcted/cache/Cypress/13.5.0/Cypress/resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
      at emit (node:internal/child_process:944:14)
      at processTicksAndRejections (node:internal/process/task_queues:83:21)

Expected behavior No tests should fail BECAUSE of the plugin. I would rather lose data than cause flaky tests.

Additional context version 2.14

RobertBattaglia avatar Jul 16 '24 20:07 RobertBattaglia

the problem should be already fixed in [email protected], could you please give it a try

baev avatar Jul 17 '24 10:07 baev

For context, with Cypress v 13.4.0 node version 20.9.0 Trying to use the 3.0.0-beta any version I get:

Oops...we found an error preparing this test file:

  > cypress/support/e2e.ts

The error was:

SyntaxError: Unexpected token (1:3594) while parsing /e2e/node_modules/allure-cypress/dist/cjs/index.js while parsing file: /e2e/node_modules/allure-cypress/dist/cjs/index.js
    at DestroyableTransform.end [as _flush] (/e2e/node_modules/insert-module-globals/index.js:114:21)
    at DestroyableTransform.prefinish (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:138:10)
    at DestroyableTransform.emit (node:events:514:28)
    at DestroyableTransform.emit (node:domain:488:12)
    at prefinish (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:619:14)
    at finishMaybe (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:627:5)
    at endWritable (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:638:3)
    at DestroyableTransform.Writable.end (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:594:22)
    at DestroyableTransform.onend (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:628:28)
    at DestroyableTransform.emit (node:events:526:35)
    at DestroyableTransform.emit (node:domain:488:12)
    at endReadableNT (/e2e/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21

RobertBattaglia avatar Jul 22 '24 14:07 RobertBattaglia