Hazyzh / jest-html-reporters

🌈 Reporter for jest test framework. 🌈
https://hazyzh.github.io/report.html
MIT License
522 stars 100 forks source link

fix: report fails on circular object clone #230

Closed oleksandr-martyniuk-deel closed 2 years ago

oleksandr-martyniuk-deel commented 2 years ago

The issue is caused by Axios. When test fails, jest seems to capture the error and the error from Axios contains circular dependencies

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property 'socket' -> object with constructor 'Object'
    --- property '_httpMessage' closes the circle
    at JSON.stringify (<anonymous>)
    at deepClone (/Users/***/node_modules/jest-html-reporters/helper.js:303:28)
    at MyCustomReporter.<anonymous> (/Users/***/node_modules/jest-html-reporters/index.js:125:58)
    at step (/Users/***/node_modules/jest-html-reporters/index.js:44:23)
    at Object.next (/Users/***/node_modules/jest-html-reporters/index.js:25:53)
    at /Users/***/node_modules/jest-html-reporters/index.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/***/node_modules/jest-html-reporters/index.js:15:12)
    at MyCustomReporter.onRunComplete (/Users/***/node_modules/jest-html-reporters/index.js:120:16)
    at ReporterDispatcher.onRunComplete (/Users/***/node_modules/@jest/core/build/ReporterDispatcher.js:71:24)