Error when using karma with Coffeescript: serializing the cyclic structure of JSON.stringify

Why am I getting this error when starting karma with Coffeescript?

$ karma run WARN [watcher]: Pattern "/home/yang/reactive.coffee/test/mock/**/*.js" does not match any file. WARN [watcher]: Pattern "/home/yang/reactive.coffee/src/**/*.js" does not match any file. PhantomJS 1.9 (Linux) ERROR TypeError: JSON.stringify cannot serialize cyclic structures. at http://localhost:8080/socket.io/socket.io.js:1066 PhantomJS 1.9 (Linux): Executed 0 of 0 ERROR (0.212 secs / 0 secs) PhantomJS 1.9 (Linux) ERROR TypeError: JSON.stringify cannot serialize cyclic structures. at http://localhost:8080/socket.io/socket.io.js:1066 PhantomJS 1.9 (Linux): Executed 0 of 0 ERROR (0.212 secs / 0 secs) 

This also happens when I switch to Firefox:

 Firefox 20.0 (Linux) ERROR TypeError: cyclic object value at http://localhost:8081/socket.io/socket.io.js:1066 

When I switch to JS from CS, the error disappears.

More details - let me know if there is anything else I can provide to be useful:

 $ karma --version Karma version: 0.8.5 $ tree src src └── reactive.coffee 0 directories, 1 file $ tree test test └── spec └── test_reactive.js 1 directory, 1 file $ cat karma.conf.js // Karma configuration // base path, that will be used to resolve files and exclude basePath = ''; // list of files / patterns to load in the browser files = [ JASMINE, JASMINE_ADAPTER, 'src/*.coffee', 'src/**/*.js', 'test/mock/**/*.js', 'test/spec/**/*.js' ]; // list of files to exclude exclude = []; // test results reporter to use // possible values: dots || progress || growl reporters = ['progress']; // web server port port = 8080; // cli runner port runnerPort = 9100; // enable / disable colors in the output (reporters and logs) colors = true; // level of logging // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG logLevel = LOG_INFO; // enable / disable watching file and executing tests whenever any file changes autoWatch = false; // Start these browsers, currently available: // - Chrome // - ChromeCanary // - Firefox // - Opera // - Safari (only Mac) // - PhantomJS // - IE (only Windows) browsers = ['PhantomJS']; // If browser does not capture in given timeout [ms], kill it captureTimeout = 10000; // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun = false; 
+4
source share
1 answer

Although I'm not sure why CS will cause this and JS won't, play around with the solution presented on SO here .

0
source

Source: https://habr.com/ru/post/1480824/


All Articles