Add full support for parametrized tests
See original GitHub issueEnvironment
node -v
: v11.10.0npm -v
: 6.7.0npm ls jest
: └── jest@24.1.0- Operating system: macOS Mojave
Prerequisite
- are you able to run jest test from command line? yes
- how do you run your tests from command line? (for example:
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
with describe.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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:12
Top Results From Across the Web
Parametrizing tests — pytest documentation
pytest allows to easily parametrize test functions. For basic docs, see How to parametrize fixtures and test functions. In the following we provide...
Read more >Guide to JUnit 5 Parameterized Tests - Baeldung
Learn how to simplify test coverage in JUnit 5 with parameterized tests.
Read more >JUnit 5 Tutorial: Writing Parameterized Tests - Petri Kainulainen
This blog post describes how we can write parameterized tests with JUnit 5. After we have finished this blog post, we: Can get...
Read more >Creating parameterised tests in xUnit with [InlineData ...
In this post I describe how to create parameterised tests using xUnit's [Theory], [InlineData], [ClassData], and [MemberData] attributes.
Read more >Parametrize class tests with pytest - python - Stack Overflow
You CAN apply parametrize to classes. From the docs: @pytest.mark.parametrize allows one to define multiple sets of arguments and fixtures at the test...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Upvote
@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?