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.

[Feature] support for `(it|test|describe).each(...)`

See original GitHub issue

Jest supports it.each: https://jestjs.io/docs/api#testeachtablename-fn-timeout with an array or a template table.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
kirillgroshkovcommented, Dec 27, 2021

15 minutes after writing last comment, managed to “money-patch” the missing test.each support by using this quick&dirty function (and my tests pass now 🚀 )

export function testEach(cases: any[][]): (name: string, fn: AnyFunction) => void {
  return (name, fn) => {
    cases.forEach(items => {
      test(name, () => fn(...items))
    })
  }
}
5reactions
patak-devcommented, Dec 13, 2021

This was also requested by @userquin in the EPIC issue. We were talking with Anthony that .each could add a lot of complexity (https://github.com/antfu-sponsors/vitest/issues/15#issuecomment-991333131). But given that the output is formatted as a table and people seem to be keen on using it, I think it would be good to have a compat story here. See also comment in twitter about .concurrent.each that is an interesting case (we could do the same with a nested describe.concurrent though)

What I told to @userquin, and maybe someone else wants to take this one, is that 1. it may be good to wait until the internals are more stable to avoid the need to refactor this feature while the code is stabilizing and 2. we could discuss with a PR implementing it, because maybe the added complexity isn’t that big at the end.

In case we don’t want to support tabular output in the reporter, maybe we could implement .each with nested describes and keep a simple tree output, but at least users could migrate from Jest without changing their code (but taking the hit of losing the table at the CLI)

Read more comments on GitHub >

github_iconTop Results From Across the Web

jest-test-mode/jest-test-mode.el at master - GitHub
Adds support for when-let ... Match Group 1 contains the function name: it, test, describe. Match Group 4 contains the test name" )....
Read more >
What Does It Usually Mean for a Feature to be "Supported"?
Save this answer. Show activity on this post. A feature is "supported" if the party responsible for the software's overall functionality ...
Read more >
How to Set Up a Continuous Integration Pipeline with GitHub ...
Lately I've added continuous integration to my blog using Puppeteer for end to end testing. My main goal was to allow automatic dependency ......
Read more >
wdio-zebr-reporter - npm Package Health Analysis - Snyk
It is Zebrunner server hostname. It can be obtained in Zebrunner on the 'Account & profile' page under the 'Service URL' section;.
Read more >
woo94 - Medium
Read writing from woo94 on Medium. Every day, woo94 and thousands of other voices read, write, and share important stories on Medium.
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