-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Support shallow arrays in jest-each #6348
Comments
Hey @captbaritone the array needs to represent a table: test.each([
[arg1, arg2, arg3], // row1
[arg1, arg2, arg3], // row2
]) We could add a check here https://github.com/facebook/jest/blob/master/packages/jest-each/src/bind.js#L24 to make sure the inner row array is actually an array. What do you think? |
Yeah, I figured that out eventually, and it makes sense. I would say we should check if it's an array and either:
|
I think option two is best, since I would imagine it's pretty common to want to make the same assertion about an array of values, and having to manually convert the array to a table is kinda gross. |
Cool I'll send a PR :) |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I expected I could write this:
But it lead to very confusing test titles and test failures:
I ended up doing something like this, and it worked.
At the very least, it would be nice to error if the values in the table are not arrays.
@mattphillips
The text was updated successfully, but these errors were encountered: