Don't wrap arrays in `test.each` template strings
See original GitHub issuePrettier 1.19.1 Playground link
Input:
test.each`
givenInteger | givenObjectArray | givenSimpleArray
${1} | ${[{ start: 5, end: 15 }]} | ${[1,2,3,4,5,6,7,8]}
${1}| ${[{ start: 5, end: 15 }]} | ${["test", "string", "for", "prettier"]}
${3} | ${[{ start: 5, end: 15 }]} | ${6}
${4} | ${[{ start: 1, end: 3 },{ start: 15, end: 20 },]} | ${15.01}
`("example test", ({givenInteger, givenObjectArray, givenSimpleArray}) => {})
Output:
test.each`
givenInteger | givenObjectArray | givenSimpleArray
${1} | ${[{ start: 5, end: 15 }]} | ${[1, 2, 3, 4, 5, 6, 7, 8]}
${1} | ${[{ start: 5, end: 15 }]} | ${["test", "string", "for", "prettier"]}
${3} | ${[{ start: 5, end: 15 }]} | ${6}
${4} | ${[
{ start: 1, end: 3 },
{ start: 15, end: 20 }
]} | ${15.01}
`("example test", ({ givenInteger, givenObjectArray, givenSimpleArray }) => {});
Expected behavior:
I would expect that the givenObjectArray
containing multiple objects does not get wrapped and stays in one line and that the alignment is working as expected. This example has been taken from an jest
test.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:9 (7 by maintainers)
Top Results From Across the Web
[Bug]: test.each jest template string variables do not work ...
[Bug]: test.each jest template string variables do not work when passing an array of object #12562.
Read more >How can i wrap loop items in an <li> tag using Template Literals
I am using template literals for this. But when i use the <li> tag inside template literals, it is not works. Can you...
Read more >Reduce boilerplate test code with Jest it.each | by E.Y. - Medium
table : Array of Arrays with the arguments that are passed into the test fn for each row. name : String the title...
Read more >String Interpolation in JavaScript - Dmitri Pavlutin
The string interpolation in JavaScript is performed by template literals (strings wrapped in backticks ` ) and ${expression} as a ...
Read more >Using Matchers - Jest
Jest uses "matchers" to let you test values in different ways. ... toEqual recursively checks every field of an object or array.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@yogmel Hi and welcome. Of course you may, go ahead. Let me know if you have questions.
Hi everyone, I’m looking for good-first-bugs to get started contributing to Prettier. May I solve this one if available?
Thanks!