-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jest-each] Add pretty format (#6357)
* Add support for %p pretty format placeholder * Add pretty format interpolation to each docs * Add pretty format to template each titles * Update changelog * Remove extra newline# * Move %p pretty option higher up in the docs
- Loading branch information
1 parent
ddfa099
commit 6f5b2f9
Showing
8 changed files
with
190 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) 2018-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const noop = () => {}; | ||
|
||
describe('array', () => { | ||
it.each([ | ||
['hello', 'hello'], | ||
[1, 1], | ||
[null, null], | ||
[undefined, undefined], | ||
[1.2, 1.2], | ||
[{foo: 'bar'}, {foo: 'bar'}], | ||
[{foo: {bar: 'baz'}}, {foo: {bar: 'baz'}}], | ||
[noop, noop], | ||
[[], []], | ||
[[{foo: {bar: 'baz'}}], [{foo: {bar: 'baz'}}]], | ||
[Infinity, Infinity], | ||
[-Infinity, -Infinity], | ||
[NaN, NaN], | ||
])('%p == %p', (left, right) => { | ||
expect(left).toEqual(right); | ||
}); | ||
}); | ||
|
||
describe('template', () => { | ||
it.each` | ||
left | right | ||
${'hello'} | ${'hello'} | ||
${1} | ${1} | ||
${null} | ${null} | ||
${undefined} | ${undefined} | ||
${1.2} | ${1.2} | ||
${{foo: 'bar'}} | ${{foo: 'bar'}} | ||
${{foo: {bar: 'baz'}}} | ${{foo: {bar: 'baz'}}} | ||
${noop} | ${noop} | ||
${[]} | ${[]} | ||
${[{foo: {bar: 'baz'}}]} | ${[{foo: {bar: 'baz'}}]} | ||
${Infinity} | ${Infinity} | ||
${-Infinity} | ${-Infinity} | ||
${NaN} | ${NaN} | ||
`('$left == $right', ({left, right}) => { | ||
expect(left).toEqual(right); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters