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

fix: add support for use of arrays in t.like #3023

Closed
wants to merge 1 commit into from

Conversation

Gozala
Copy link

@Gozala Gozala commented May 12, 2022

fixes: #2627

Copy link
Member

@novemberborn novemberborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @Gozala! I think this could work, but it's been a while since I've thought about the logic here. It'll definitely need tests, I think the existing ones are in test-tap/assert.js.

return selector !== null
&& typeof selector === 'object'
&& Reflect.getPrototypeOf(selector) === Object.prototype
&& (prototype === Object.prototype || prototype === Array.prototype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could use Array.isArray(selector). Note that Reflect.ownKeys() on an array returns length which messes up the next condition.

@novemberborn
Copy link
Member

Hi @Gozala, do you think you would have time to get back to this?

@Gozala
Copy link
Author

Gozala commented Jun 6, 2022

Hi @Gozala, do you think you would have time to get back to this?

I'm afraid not. I end up switching off of ava as it would not run in browser contexts. If I get back to using ava I'll definitely make some time for this.

@novemberborn
Copy link
Member

No problem, thanks!

tommy-mitchell pushed a commit to tommy-mitchell/ava that referenced this pull request Mar 13, 2023
tommy-mitchell added a commit to tommy-mitchell/ava that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

t.like not handling arrays as expected
2 participants