Skip to content
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

Jest parameterized tests doesn't run correctly #2399

Open
rushikeshpatangrao opened this issue Jun 20, 2022 · 1 comment
Open

Jest parameterized tests doesn't run correctly #2399

rushikeshpatangrao opened this issue Jun 20, 2022 · 1 comment

Comments

@rushikeshpatangrao
Copy link

Expected Behavior

Test Explorer should list down parameterized tests independently and run them correctly

Actual Behavior

Test explorer only shows and runs the first test and it also breaks when you try to include parameters in the test name.

  • NTVS Version: 1.5.40404.3
  • Visual Studio Version: 2022
  • Node.js Version: 16.15.1
Steps to Reproduce
  1. Create a new project using docs : https://docs.microsoft.com/en-us/visualstudio/javascript/tutorial-create-react-app?view=vs-2022
  2. In app.test.js, added a parameterized jest test.
test.each([
    [true, true],
    [false, false]
])('dummy test', (a, b) => {
    expect(a).toBe(b);
});
  1. When I build the project and open test explorer, it was expected to show two tests, but shows a single one
    image

  2. If I change the test to something which is expected to fail, like

test.each([
    [true, true],
    [false, true]
])('dummy test', (a, b) => {
    expect(a).toBe(b);
});

The test explorer shows that the test still passes, which is because it seems to only run the first test

  1. If I change the test name to be something parameterized,
test.each([
    [true, true],
    [false, false]
])('expect %p to be %p', (a, b) => {
    expect(a).toBe(b);
});

then the test fails in test explorer and test explorer doesn't show it correctly
image

@rushikeshpatangrao rushikeshpatangrao changed the title Jest parameterized doesn't run correctly Jest parameterized tests doesn't run correctly Jun 21, 2022
@mjabl
Copy link

mjabl commented Dec 21, 2023

Same issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants