Closed cannikin closed 8 years ago
What version of jasmine are you using?
The problem is basically that once the models are put into a collection they become cyclic. One of the models properties is the collection, the collection has an array of models, etc. One way to work around this would be to write a custom equality tester that knows to compare two Backbone.Model
objects by looking at their attributes
(I think that's what it's called).
I'm on 2.2.0 of Jasmine.
How come that cyclical nature doesn't cause a problem when running the tests in the browser, only through the CI?
I updated my test to check that the ID attribute matched instead of the whole object. Works like a charm, thanks!
The cyclical nature usually causes problems specifically when trying to serialize the data from the browser out to either phantomjs or selenium (depending on which browsers you're using).
Or it could just be a difference between running the specs in Chrome vs running them in PhantomJS and what the maximum stack depth is.
Closing, since it sounds like you've got a fix that works for you.
Any hints as to what could be happening here? I've got a spec that runs fine in Chrome with
rake jasmine
but fails in the terminal withrake jasmine:ci
. It's testing a Backbone.js comparator. It looks like it blows the stack trying to run the test:Here's the stack trace: https://gist.github.com/cannikin/ac26ad79879b10926d68
I see a bunch of
<circular reference: Object>
in the output which is why I'm guessing the stack is overflowing. But why is it only a problem when PhantomJS is running things and not Chrome?