question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.28.1 - cy.allure().writeEnvironmentInfo() no longer generates widgets/environment.json

See original GitHub issue

When I upgrade to versions of cypress-allure-plugin higher than 2.28.0, my unit tests fail because widgets/environment.json has empty array as contents, instead of the expected contents. I am generating this using cy.allure().writeEnvironmentInfo().

Cypress version: 9.7.0 Node version: 16.17.1 cypress-allure-plugin version: >=2.28.1 all seem to have this issue OS: Mac 12.6 Monterey

To Reproduce Steps to reproduce the behavior:

  1. Install the above versions
  2. Write an environment file using cy.allure().writeEnvironmentInfo({ foo: 'bar' })
  3. Open the report - the environment area is blank.
  4. Open cypress/reports/widgets/environment.json - the contents are an empty array.

Expected behavior The Allure report should contain Environment info as it did before 2.28.1.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mysticdevxcommented, Nov 2, 2022

Cypress version: 10.9.0 @badeball/cypress-cucumber-preprocessor: 13.0.3 (latest) cypress-allure-plugin: 2.33.1 node: 14.17.3

Hi, I have upgraded to v2.33.1 but still the environment.json file returns as an empty array when report is prepared. I can see xxxx.results.json and yyyy.container.json files in the/allure-results path. However envorimnet.json is missing. I get error while writing allure results: ReferenceError: filePath is not defined error.

I have tried both wit and without defining the allureResultsPath configuration, both were unsuccessful. You can see Debug logs:

 allure-plugin:writer starting writing allure results to "/Users/xxxxx/WebstormProjects/yyyyy-ui/packages/zzzzz-ui/allure-results" +8s
  allure-plugin:writer write suite "Help Panel" to file "19455105-477c-463e-9b65-dba705c7a2b3-container.json" +1ms
  allure-plugin:writer write test "User navigates to Help panel" to file "756c7ff7-0f8f-455b-af04-dfe1b44d19d4-result.json" +1ms
  allure-plugin:writer removing empty step ""after each" hook" from test "756c7ff7-0f8f-455b-af04-dfe1b44d19d4" +1ms
  allure-plugin:writer write file "/Users/xxxxx/WebstormProjects/yyyyy-ui/packages/zzzzz-ui/allure-results/categories.json" +0ms
error while writing allure results: ReferenceError: filePath is not defined  allure-plugin:writer failed to write allure results: ReferenceError: filePath is not defined
  allure-plugin:writer     at writeInfoFile (/Users/xxxxx/WebstormProjects/zzzzz-ui/node_modules/@shelex/cypress-allure-plugin/writer/writeInfoFiles.js:10:20)
  allure-plugin:writer     at writeAllureResults (/Users/xxxxx/WebstormProjects/zzzzz-ui/node_modules/@shelex/cypress-allure-plugin/writer.js:227:17)
  allure-plugin:writer     at invoke (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:256:16)
  allure-plugin:writer     at /Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:59:14
  allure-plugin:writer     at tryCatcher (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
  allure-plugin:writer     at Function.Promise.attempt.Promise.try (/Users/xxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
  allure-plugin:writer     at Object.wrapChildPromise (/Users/xxxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:58:23)
  allure-plugin:writer     at RunPlugins.taskExecute (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:262:10)
  allure-plugin:writer     at RunPlugins.execute (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:182:21)
  allure-plugin:writer     at EventEmitter.<anonymous> (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/child/run_plugins.js:279:12)
  allure-plugin:writer     at EventEmitter.emit (events.js:375:28)
  allure-plugin:writer     at EventEmitter.emit (domain.js:470:12)
  allure-plugin:writer     at process.<anonymous> (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/packages/server/lib/plugins/util.js:33:22)
  allure-plugin:writer     at process.emit (events.js:387:35)
  allure-plugin:writer     at process.emit (domain.js:470:12)
  allure-plugin:writer     at process.emit.sharedData.processEmitHook.installedValue [as emit] (/Users/xxxxxx/Library/Caches/Cypress/10.9.0/Cypress.app/Contents/Resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:745:40)
  allure-plugin:writer     at emit (internal/child_process.js:910:12)
  allure-plugin:writer     at processTicksAndRejections (internal/process/task_queues.js:83:21) +0ms
  allure-plugin:writer got "after:spec" process message +7ms
  allure-plugin:writer processing "after:spec" results +1ms
  allure-plugin:writer going to check attachments for "756c7ff7-0f8f-455b-af04-dfe1b44d19d4" +0ms
  allure-plugin:writer video will not be attached +0ms

0reactions
github-actions[bot]commented, Nov 2, 2022

🎉 This issue has been resolved in version 2.33.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

please add label->framework · Issue #42 · Shelex/cypress ...
and generate a report - it will have no effect. So I would advise several options: cy.allure().writeEnvironmentInfo({ "framework": "Cypress" }) ...
Read more >
Custom Video Path,about Shelex/cypress-allure-plugin - Coder Social
Custom Video Path about cypress-allure-plugin HOT 2 CLOSED. shelex avatar ... writeEnvironmentInfo() no longer generates widgets/environment.json HOT 5 ...
Read more >
shelex/cypress-allure-plugin/README.md - UNPKG
Take into account that Cypress generate plugins file with `module.exports` on the first initialization but you should have only one export section.
Read more >
@shelex/cypress-allure-plugin - npm
Commands are producing allure steps automatically based on cypress events and are trying to represent how code and custom commands are executed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found