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

chore: fix some type errors in tests #13360

Merged
merged 8 commits into from
Oct 3, 2022
Merged

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Oct 2, 2022

Summary

I was bored on my flight home, so went over a random assortment of tests and fixed some type errors.

Ignore whitespace for this one: https://github.com/facebook/jest/pull/13360/files?w=1

Test plan

Green CI

'beforeAll',
'afterEach',
'afterAll',
] as Array<Circus.HookType>)('%s hooks error throwing', fn => {
Copy link
Contributor

@mrazauskas mrazauskas Oct 2, 2022

Choose a reason for hiding this comment

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

No magic with as const? (By the way, I guess this could might be good candidate for satisfies.)

Suggested change
] as Array<Circus.HookType>)('%s hooks error throwing', fn => {
] as const)('%s hooks error throwing', fn => {

Copy link
Member Author

Choose a reason for hiding this comment

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

as const doesn't really work - then it's always hard coded to the first value

Copy link
Member Author

Choose a reason for hiding this comment

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

probably an issue with jest-each's types, but I haven't dug into it

Copy link
Contributor

Choose a reason for hiding this comment

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

Just checked. Interesting... I will check what is going on.

Copy link
Contributor

@mrazauskas mrazauskas Oct 2, 2022

Choose a reason for hiding this comment

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

Yep. Types are buggy and test is broken too.

https://github.com/facebook/jest/blob/22322c9acc3197e43337b5415755823f09f410fe/packages/jest-types/__typetests__/each.test.ts#L31

Here list is [1, 2, 3]. That’s why it looks like just first value is picked up. Add second arg and second value will be there. In reality there is no second arg ;D Ups.. I will fix. Good to catch it!

@SimenB SimenB merged commit 286dab2 into jestjs:main Oct 3, 2022
@SimenB SimenB deleted the fix-type-errors-tests branch October 3, 2022 07:16
@github-actions
Copy link

github-actions bot commented Nov 3, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants