question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add full support for parametrized tests

See original GitHub issue

Environment

  1. node -v: v11.10.0
  2. npm -v: 6.7.0
  3. npm ls jest: └── jest@24.1.0
  4. 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 or node_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.

screenshot 2019-02-25 at 10 34 51

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:23
  • Comments:12

github_iconTop GitHub Comments

5reactions
dgreene1commented, Jul 24, 2019

Upvote

3reactions
connectdotzcommented, Jan 27, 2021

@DScheglov I tried your snippet above and all seems to be fine:

Screen Shot 2021-01-27 at 4 45 30 PM

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found