busterjs/buster — Issue #124: Cyclical data structure with assert.calledWith yields "InternalError: too much recursion"
Author: ende76
Created: 2012-03-08 13:33:45+00:00
State: open

# Description

When implementing cyclical data structures (doubly-linked lists, tree structures with parent references), and then using assert.calledWith() on a spy/stub, an InternalError is thrown.

assert.equals() appears to have the same problem.

## Example

A minimal example can be found at https://github.com/ende76/buster.internalerror .
The test `treenode module`-> `method has()` -> `should call find() on child nodes` should *fail*, but instead *errors*.

## Naive analysis

From an outside view, it seems that in deep-comparison cases, cyclical structured would have to be recognized and avoided, which might be non-trivial.