avajs/ava

`t.like()` selector must not contain circular references

guoard opened this issue · 1 comments

guoard commented

Hi,

The following code works in ava version 5.2.0:

const arr = ['c1', 'c2']
t.like({a: 'a', b: 'b', c: ['c1', 'c2'], d: ['c1', 'c2']}, {b: 'b', d: arr, c: arr})

However, it does not work in version 5.3.0 and seems to be related to pull request #3185.

Receive this error:

`t.like()` selector must not contain circular references

It worked because before 5.3 we treated arrays as values rather than selectors.

However this problem would have occurred if d and c were the same object, since the circular detection was more of a "did I see this object before" and did not actually detect circular references.