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

Tests marked with each are not added in total count #9506

Closed
Mark1626 opened this issue Feb 3, 2020 · 4 comments · Fixed by #9818
Closed

Tests marked with each are not added in total count #9506

Mark1626 opened this issue Feb 3, 2020 · 4 comments · Fixed by #9818

Comments

@Mark1626
Copy link
Contributor

Mark1626 commented Feb 3, 2020

🐛 Bug Report

Tests within each are not considered in total test count. If a test contains on test.each the test file is not being run and Your test suite must contain at least one test. is thrown

Noticed this in #9326

cc\ @mattphillips @SimenB

To Reproduce

Steps to reproduce the behavior:

In the following total test count is considered as zero

test.each(
  [
    [1, 1, 2],
    [1, 2, 3],
    [2, 1, 3]
  ],
  "returns the result of adding %d to %d",
  async (a, b, expected) => {
    expect(a + b).toBe(expected);
  }
);

Expected behavior

Tests within each should be considered in the total test count

Link to repl or repo (highly encouraged)

https://github.com/M4rk9696/each-test-count-bug

envinfo


  System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 10.16.0
    Yarn: 1.13.0
    npm: 6.9.0
  npmPackages:
    jest: ^25.1.0 => 25.1.0

@SimenB
Copy link
Member

SimenB commented Feb 3, 2020

It's because the API is used wrong.

@@ -3,7 +3,7 @@ test.each(
     [1, 1, 2],
     [1, 2, 3],
     [2, 1, 3]
-  ],
+  ])(
   "returns the result of adding %d to %d",
   async (a, b, expected) => {
     expect(a + b).toBe(expected);

We should probably detect that bind is called with more arguments than we expect. @mattphillips thoughts?

@ghostd
Copy link
Contributor

ghostd commented Apr 5, 2020

Hi,

I think we can move the call to validateArrayTable up into the binding (before returning the function eachBind). I could make a PR if you think is enough.

Regards

@SimenB
Copy link
Member

SimenB commented Apr 5, 2020

Sounds like a great start! A PR with tests would be wonderful 👍

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants