-
Notifications
You must be signed in to change notification settings - Fork 294
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
Add full support for parametrized tests #427
Comments
Was just looking for the same thing. it.each/test.each does not work, but it would be really helpful if it would. To use describe.each instead is not an applicable workaround for me as it defeats the purpose of having several things to test for one describe. |
Upvote |
Upvote and bump 👍 |
upvote |
for people who are interested in this issue, please try v4-alpha that should have addressed this issue. |
@connectdotz , I'm using it seams when there is only one
{
"preset": "ts-jest",
"testEnvironment": "node",
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.ts"
]
} describe('id', () => {
it.each([
[true],
[false],
])('returns %s for %s', value => {
expect(value).toBe(value);
});
});
describe('not', () => {
it.each([
[true],
[false],
])('%s not equal to reverse', value => {
expect(!value).not.toBe(value);
});
}); |
indeed we have some gaps to cover... see #649 |
v4.0.0-alpha.3 is released today. The main change is to support the parameterized tests. Feel free to give this release a try and open new issues if needed... |
I will try it today some later. Thanks a lot for a quick fix! |
@connectdotz , hey Now correctly works only the first in the file And I guess the number of test-cases is displayed for whole file. |
@DScheglov I tried your snippet above and all seems to be fine: Something else is at play here... which jest version your project is on? I should have mentioned that for parameterized tests to be properly reported, you need to have jest version >= 26.5.0 (see migration notes for alpha.3 release). Otherwise, can you post the relevant debug message from the developer console or OUTPUT channel? |
Hey, @connectdotz thanks. I had 25.x.x version of jest. Upgrading it to the 26.6.3 helped. Now it works well. |
Environment
node -v
: v11.10.0npm -v
: 6.7.0npm ls jest
: └── [email protected]Prerequisite
npm run test
ornode_modules/.bin/jest
)npm test
Expected Behavior
When using syntax
test.each(table)(name, fn, timeout)
described here test status circles show the status of tests and failed test error appears in-line.Actual Behavior
When using syntax
test.each(table)(name, fn, timeout)
test status circles are not shown and test errors are not displayed inline.Workaround
If applying parametrization to
describe
withdescribe.each
, test status information seems to be showed correctly.In the image below all three tests should have been marked as failed. As it can be seen, the second does not show any test status information and the third (workaround) seems to work. Since I don't want to wrap all my separate tests into
describe.each
workaround is not that useful in my case.The text was updated successfully, but these errors were encountered: