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-each]: Add empty string/array validation check #7249

Merged
merged 5 commits into from
Oct 30, 2018

Conversation

mattphillips
Copy link
Contributor

Summary

Motivation: @SimenB's #7100 (comment)

We should probably throw on empty arrays as well, not just non-arrays

Test plan

  • Unit tests

@SimenB
Copy link
Member

SimenB commented Oct 23, 2018

Nice!

This works for

test.each``('bla', () => {});

as well?

@mattphillips mattphillips changed the title [jest-each]: Add empty array validation check [jest-each]: Add empty string/array validation check Oct 23, 2018
@SimenB
Copy link
Member

SimenB commented Oct 23, 2018

And

test.each`
  a    | b    | expected
`('bla', () => {});

?

@codecov-io
Copy link

Codecov Report

Merging #7249 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7249      +/-   ##
==========================================
+ Coverage   66.55%   66.57%   +0.01%     
==========================================
  Files         237      237              
  Lines        9317     9321       +4     
  Branches        3        3              
==========================================
+ Hits         6201     6205       +4     
  Misses       3115     3115              
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-each/src/bind.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdf7a22...56081b5. Read the comment docs.

tableArg[0].trim() === ''
) {
const error = new ErrorWithStack(
'Error: `.each` called with an empty tagged template string of table data.\n',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's called "tagged template literal"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot!

@SimenB SimenB merged commit 51e68e7 into jestjs:master Oct 30, 2018
@mattphillips mattphillips deleted the jest-each-empty branch October 30, 2018 09:24
@github-actions
Copy link

This pull request 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 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants