Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

TypeError: JSON.stringify cannot serialize cyclic structures #213

Open
ricazhang opened this issue Apr 4, 2018 · 0 comments
Open

TypeError: JSON.stringify cannot serialize cyclic structures #213

ricazhang opened this issue Apr 4, 2018 · 0 comments

Comments

@ricazhang
Copy link

This is with version 1.0.4 of karma-phantomjs-launcher on a Windows 7 machine.

I'm trying to run karma tests using angular cli and PhantomJS (ng test --code-coverage --single-run) but am getting an error which seems to be causing 24 out of my 33 unit tests to fail. When I run the tests with Chrome as the configured browser, all of the tests pass.

PhantomJS 2.1.1 (Windows 7.0.0) AppService should be created FAILED
    TypeError: JSON.stringify cannot serialize cyclic structures. in http://localhost:9876/_karma_webpack_/polyfills.bundle.js (line 5424)
    stringify@[native code]
    stringify@http://localhost:9876/_karma_webpack_/polyfills.bundle.js:5424:28
    displayModal@http://localhost:9876/_karma_webpack_/scripts.bundle.js:4473:57
    createModalContent@http://localhost:9876/_karma_webpack_/scripts.bundle.js:4453:41
    BMS@http://localhost:9876/_karma_webpack_/scripts.bundle.js:7282:43
    BMSService@http://localhost:9876/_karma_webpack_/main.bundle.js:2095:25930
    _createClass@http://localhost:9876/_karma_webpack_/vendor.bundle.js:84475:34
    _createProviderInstance$1@http://localhost:9876/_karma_webpack_/vendor.bundle.js:84447:38
    resolveNgModuleDep@http://localhost:9876/_karma_webpack_/vendor.bundle.js:84432:42
    _createClass@http://localhost:9876/_karma_webpack_
    ...(there was more in the stack but I cropped it)

In other issues people had with Karma and PhantomJS some suggested uncommenting the polyfills.ts file. I figured that might be related since the error seems to be coming from the polyfills bundled file so I tried running the tests with the polyfills commented out and also with them uncommented out and it didn't make a difference either way.

Here is my karma.conf.js file: https://codepen.io/anon/pen/NYBypv

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

No branches or pull requests

1 participant