Using test.each will create one test for each test case, so if it fails, you will know exactly which test case failed. It will also run the rest of the test cases even if one failed.
If you use for each, then your entire test will fail on the first case failure, and you will not know which one failed quickly.
What is the benefit of using the test.each of jest instead of js for each? I think it is more readable and friendly the js way
Using test.each will create one test for each test case, so if it fails, you will know exactly which test case failed. It will also run the rest of the test cases even if one failed.
If you use for each, then your entire test will fail on the first case failure, and you will not know which one failed quickly.
That's not completely true. You can put an
it
inside a forEach loop and get the same behavior.