Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Converting circular structure to JSON #73

Closed
kirilldev opened this issue Dec 4, 2019 · 1 comment
Closed

TypeError: Converting circular structure to JSON #73

kirilldev opened this issue Dec 4, 2019 · 1 comment

Comments

@kirilldev
Copy link

kirilldev commented Dec 4, 2019

I am using jest-cucumber with an angular 6 project. There is a problem that if an error appears on template side angular generates an error object with a circular structure.

Later when ScenarioResultFileOperations.saveScenarioResult is called I am getting an error.

TypeError: Converting circular structure to JSON
      at JSON.stringify (<anonymous>)

    at node_modules/jest-cucumber/src/reporting/scenario-result-tracking/ScenarioResultFileOperations.ts:23:30
    at new ZoneAwarePromise (node_modules/zone.js/dist/zone.js:910:29)
    at Object.<anonymous>.exports.saveScenarioResult (node_modules/jest-cucumber/src/reporting/scenario-result-tracking/ScenarioResultFileOperations.ts:22:10)
    at ScenarioResultTracker.Object.<anonymous>.ScenarioResultTracker.endScenario (node_modules/jest-cucumber/src/reporting/scenario-result-tracking/ScenarioResultTracker.ts:36:4)
    at node_modules/jest-cucumber/src/feature-definition-creation.ts:161:22
    at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:391:26)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:131:39)
    at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:390:52)
    at Zone.Object.<anonymous>.Zone.run (node_modules/zone.js/dist/zone.js:150:43)
    at node_modules/zone.js/dist/zone.js:889:34
    at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invokeTask (node_modules/zone.js/dist/zone.js:423:31)
    at ProxyZoneSpec.Object.<anonymous>.ProxyZoneSpec.onInvokeTask (node_modules/zone.js/dist/proxy.js:162:39)
    at ZoneDelegate.Object.<anonymous>.ZoneDelegate.invokeTask (node_modules/zone.js/dist/zone.js:422:60)
    at Zone.Object.<anonymous>.Zone.runTask (node_modules/zone.js/dist/zone.js:195:47)
    at drainMicroTaskQueue (node_modules/zone.js/dist/zone.js:601:35)
    at Object.<anonymous>.ZoneTask.invokeTask (node_modules/zone.js/dist/zone.js:502:21)
    at ZoneTask.invoke (node_modules/zone.js/dist/zone.js:487:48)
    at timer (node_modules/zone.js/dist/zone.js:2281:29)
    at Timeout.callback [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:678:19)

To fix the problem, instead of JSON.stringify we need to use something that can handle circular dependencies.

@bencompton
Copy link
Owner

This duplicates #27, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants