allure-framework / allure-js

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

RangeError: Maximum call stack size exceeded #1022

Closed wenmhan closed 1 week ago

wenmhan commented 1 week ago

Describe the bug

When I used cy.fixture() to read a picture file of about 1.76M, an error of "RangeError: Maximum call stack size exceeded" was reported , To Reproduce import { epic, attachment, parameter } from "allure-js-commons"

describe('Attachment Test', () => {

it("attach", () => { cy.fixture("/base2/fleetmap.png", null).then((file) => { attachment("My image", file, "image/png") })

}) }

Screenshots

![Uploading 20240627195536.png…]()

Desktop (please complete the following information):

wenmhan commented 1 week ago

error message:

 RangeError: Maximum call stack size exceeded
  at oe (webpack://dtv-fe-auto/./node_modules/allure-cypress/dist/cjs/index.js:1:7292)
  at b.attachment (webpack://dtv-fe-auto/./node_modules/allure-cypress/dist/cjs/index.js:1:8269)
  at callRuntimeMethod (webpack://dtv-fe-auto/./node_modules/allure-js-commons/dist/cjs/facade.js:19:0)      
  at attachment (webpack://dtv-fe-auto/./node_modules/allure-js-commons/dist/cjs/facade.js:81:0)
  at Context.eval (webpack://dtv-fe-auto/./cypress/e2e/visualTest/commonTest/common-menu-test.js:8:17)   
epszaw commented 1 week ago

The feature works well in the next 3.0.0 version.

An example of code which processes cypress fixture:

import { attachment } from "${allureCommonsModulePath}";

it("with commands", () => {
  cy.fixture("sample.json").then((data) => {
    attachment("foo", JSON.stringify(data, null, 2), "application/json");
  })
});