Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.like() selector must not contain circular references #3205

Closed
guoard opened this issue Jun 1, 2023 · 1 comment · Fixed by #3212
Closed

t.like() selector must not contain circular references #3205

guoard opened this issue Jun 1, 2023 · 1 comment · Fixed by #3212
Assignees
Labels
bug current functionality does not work as desired

Comments

@guoard
Copy link

guoard commented Jun 1, 2023

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
@novemberborn novemberborn self-assigned this Jun 16, 2023
novemberborn added a commit that referenced this issue Jun 16, 2023
The previous implementation tracked each object, even if not circular. Update to use a stack.

Fixes #3205.
@novemberborn novemberborn added bug current functionality does not work as desired and removed needs triage labels Jun 16, 2023
@novemberborn
Copy link
Member

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.

novemberborn added a commit that referenced this issue Jun 16, 2023
The previous implementation tracked each object, even if not circular. Update to use a stack.

Fixes #3205.
novemberborn added a commit that referenced this issue Jun 16, 2023
The previous implementation tracked each object, even if not circular. Update to use a stack.

Fixes #3205.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants