Skip to content

chore(eslint-plugin): consistently use it in tests #10680

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

Closed
wants to merge 1 commit into from

Conversation

43081j
Copy link
Contributor

@43081j 43081j commented Jan 18, 2025

Changes a few occurrences of test(name, fn) to use it(name, fn) for consistency with the rest of the codebase.

PR Checklist

Changes a few occurrences of `test(name, fn)` to use `it(name, fn)` for
consistency with the rest of the codebase.
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @43081j!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented Jan 18, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit ae4333c
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/678bc2db5a97cd0008a0ec2e
😎 Deploy Preview https://deploy-preview-10680--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

nx-cloud bot commented Jan 18, 2025

View your CI Pipeline Execution ↗ for commit ae4333c.

Command Status Duration Result
nx run-many --target=build --exclude website --... ✅ Succeeded 56s View ↗
nx run-many --target=clean ✅ Succeeded 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-19 16:27:44 UTC

Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

LGTM!

@kirkwaiblinger kirkwaiblinger added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Jan 19, 2025
@kirkwaiblinger kirkwaiblinger changed the title test(eslint-plugin): consistently use it in tests chore(eslint-plugin): consistently use it in tests Jan 19, 2025
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

-0.5 from me, but if the rest of the team disagrees I don't mind this being merged at all. Thanks for sending!

expect(areOptionsValid(exampleRule, ['value-a'])).toBe(true);
});

describe('returns false for invalid options', () => {
test('bad enum value', () => {
it('bad enum value', () => {
Copy link
Member

Choose a reason for hiding this comment

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

🤔 I actually like test() here over it(). The test name doesn't grammatically read out as a full sentence. I've personally kind of gravitated towards:

  • it(): for most tests, if there's at all a way to phrase it as "it X when Y" or something like that
  • test(): as a fallback if there's no logic, just a descriptor - like "test X"

Copy link
Contributor Author

@43081j 43081j Jan 19, 2025

Choose a reason for hiding this comment

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

I don't really care which one we use as long as it is one, and not two

If you can get the others to agree, I'm happy to update

I don't think you should end up with both. What you say makes sense but, if anything, suggests you would prefer having test throughout

Copy link
Member

Choose a reason for hiding this comment

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

Oh don't get me wrong, I think it() is the right choice almost all of the time. Just my personal nitpicky preference is to use test() in specific situations. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, my preference is actually suite/test/assert. But the most consistent thing we can do right now is it it seems

As a middle ground, id prefer to later move from the now-consistent it to test if anything

@kirkwaiblinger
Copy link
Member

Oh, I apologize, I made a mistake here. I had assumed that this was a necessary change for moving to vitest, because of its inclusion in #10579. However, now that I realize that vitest has test() also I don't think we should do this as part of the vitest effort, sorry. It's just noise on unrelated changes. My opinion is that we should

  1. Not proceed with this PR
  2. Remove the test() -> it() changes from chore(eslint-plugin): migrate to vitest #10579

Sincere apologies again to @43081j for my misunderstanding and for requesting this PR only to close it 🙁 And thank you to @JoshuaKGoldberg for pointing out my mistake!

@43081j 43081j deleted the consistent-tests branch January 20, 2025 10:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants