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)
The issue is caused by
Axios
. When test fails,jest
seems to capture the error and the error fromAxios
contains circular dependencies