Skip to content

Conversation

@ninevra
Copy link
Contributor

@ninevra ninevra commented Jul 13, 2020

Adds support for the like() assertion to the assertion-arguments, use-t-well, and prefer-power-assert rules.

For prefer-power-assert, I added like() to the list of allowed assertions. prefer-power-assert says it allows assertions with no power-assert equivalent, and I don't think there is such an equivalent. prefer-power-assert also allows deepEqual(), upon which like() is based.

I didn't find any other rules that need special support for like().

One additional thing that might be useful for like() support would be a rule ensuring that, if any non-semver experiments are used, then ava's config properly enables them and package.json pins ava to a specific version instead of using a semver range. I'm not sure how practical this is and in any case I think it would be a subject for another pr.

Closes #302, hopefully.

@novemberborn
Copy link
Member

@ninevra I haven't had a chance to look at this yet, sorry. From your PR description everything sounds great though. Good job thinking of prefer-power-assert!

One additional thing that might be useful for like() support would be a rule ensuring that, if any non-semver experiments are used, then ava's config properly enables them and package.json pins ava to a specific version instead of using a semver range. I'm not sure how practical this is and in any case I think it would be a subject for another pr.

It shouldn't be that straight-forward to enable an experiment 😉

For t.like() we'll ship it without the flag soon.

ninevra added 2 commits July 18, 2020 23:33
Place t.like() tests between t.is() and t.not() in
alphabetically-ordered blocks, and after t.deepEqual() and
t.notDeepEqual() in structurally-ordered blocks.
@ninevra
Copy link
Contributor Author

ninevra commented Jul 19, 2020

I noticed the placement of the new test cases clashed with the ordering of the existing test cases. Refactored a bit to fix this, no functional changes.

@novemberborn
Copy link
Member

I wasn't online much this weekend so I haven't been able to look at this yet, sorry.

@novemberborn novemberborn changed the title like() assertion support Support t.like() assertion Jul 26, 2020
@novemberborn novemberborn merged commit 4b1df49 into avajs:master Jul 26, 2020
@novemberborn
Copy link
Member

Looks great, thanks @ninevra!

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.

Add like assertion

2 participants