allure-framework / allure-js

Allure integrations for JavaScript test frameworks
https://allurereport.org/
Apache License 2.0
224 stars 119 forks source link

allure-cypress : getting error - 'Converting circular structure to JSON' #1070

Closed delatrie closed 1 day ago

delatrie commented 1 month ago

Discussed in https://github.com/orgs/allure-framework/discussions/2650

Originally posted by **pranit-lqc** July 22, 2024 We are using Vue 3 component on the UI side. Version, "allure-commandline": "^2.29.0", "allure-cypress": "^3.0.0-beta.7", "cypress": "13.5.1", Getting below error: without the Allure plugin, we don't see this error.
delatrie commented 1 month ago

Presumably, we're trying to stringify too much here:

https://github.com/allure-framework/allure-js/blob/e4e77f74c2c47751085b43f4afa27c1d90ae7769/packages/allure-cypress/src/index.ts#L542

Karczewski commented 1 month ago

Hi, I'm encountering the same issue. Instead of using JSON.stringify, you can use something like this:

function safeStringify(obj, replacer, spaces) {
  try {
    return JSON.stringify(obj, replacer, spaces);
  } catch (error) {
    return `[Unserializable: ${error.message}]`;
  }
};
perrsikk commented 3 weeks ago

Hello Issue reproduces with latest allure-cypress version "3.0.0-beta.10" image

baev commented 3 weeks ago

@perrsikk thanks for the info

BlessedLongsword commented 3 weeks ago

I am also having this issue. For now, it has happened when doing a cy.wrap() inside a .each() loop of a list of DOM elements, or at the end of a .within() block.

For example:

Vinit-Sapiens commented 1 week ago

@delatrie , any update on issue. it is kind of blocker for us.

delatrie commented 3 days ago

The fix will be released as soon as #1127 gets reviewed & merged.