vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
758 stars 86 forks source link

Doesn't support creating `test`s with `forEach` loop #163

Closed selfrefactor closed 8 months ago

selfrefactor commented 1 year ago

It simply skips the tests when I request a run, even though tests are shown. I think this is valid use case, as it is normal to want to apply DRY in our unit tests:

const TEST_DATA = [
  {label: 'episode', key: 'TEST-1'},
  {label: 'season', key: 'TEST-2'},
]

TEST_DATA.forEach(({label, key}) => {
  test(`with ${label}`, () => {
    let {item, level} = foo(getTestTreeData(), key)
    expect(item[ID]).toBe(key)
  })
})
tjx666 commented 1 year ago

same here: https://github.com/tjx666/leetcode-javascript-2023/tree/main

https://github.com/vitest-dev/vscode/assets/41773861/972396aa-8e58-47c4-9360-b20f69bac1bb

eavidy commented 1 year ago

forEach is similar to test.each Similar issue: #7

sheremet-va commented 8 months ago

This should be fixed in pre-release 0.5.0 and higher. Note that the extension now requires Vitest 1.4.0 or higher.