-
Notifications
You must be signed in to change notification settings - Fork 45.7k
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
scripts/jest/matchers/toWarnDev: Expected and actual arguments to jest-diff
are mixed up.
#12285
Comments
sompylasar
added a commit
to sompylasar/react
that referenced
this issue
Feb 26, 2018
…ebook#12285) `toWarnDev` calls `jestDiff(a, b)` which calls `diffStrings(a, b)` where by default `a` is annotated as `'Expected'` (green), `b` as `'Received'` (red). So the first argument passed into `jestDiff` should be the expected message, the second should be the actual message. It was vice versa previously. - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L54 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L93 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/diff_strings.js#L249-L251
sompylasar
added a commit
to sompylasar/react
that referenced
this issue
May 22, 2018
…ebook#12285) `toWarnDev` calls `jestDiff(a, b)` which calls `diffStrings(a, b)` where by default `a` is annotated as `'Expected'` (green), `b` as `'Received'` (red). So the first argument passed into `jestDiff` should be the expected message, the second should be the actual message. It was vice versa previously. - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L54 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L93 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/diff_strings.js#L249-L251
sompylasar
added a commit
to sompylasar/react
that referenced
this issue
Jun 8, 2018
…ebook#12285) `toWarnDev` calls `jestDiff(a, b)` which calls `diffStrings(a, b)` where by default `a` is annotated as `'Expected'` (green), `b` as `'Received'` (red). So the first argument passed into `jestDiff` should be the expected message, the second should be the actual message. It was vice versa previously. - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L54 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L93 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/diff_strings.js#L249-L251
gaearon
pushed a commit
that referenced
this issue
Jun 8, 2018
) (#12288) `toWarnDev` calls `jestDiff(a, b)` which calls `diffStrings(a, b)` where by default `a` is annotated as `'Expected'` (green), `b` as `'Received'` (red). So the first argument passed into `jestDiff` should be the expected message, the second should be the actual message. It was vice versa previously. - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L54 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/index.js#L93 - https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/diff_strings.js#L249-L251
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you want to request a feature or report a bug?
bug
What is the current behavior?
toWarnDev
callsjestDiff(a, b)
asjestDiff(normalizedMessage, expectedMessages[0])
andjestDiff([normalizedMessage], expectedMessages)
:react/scripts/jest/matchers/toWarnDev.js
Lines 49 to 57 in 94518b0
jestDiff(a, b)
callsdiffStrings(a, b)
where by defaulta
is annotated as'Expected'
(green),b
as'Received'
(red).https://github.com/facebook/jest/blob/457776b2889a9be1ce8a2c636a23417264a98d99/packages/jest-diff/src/diff_strings.js#L86-L90
What is the expected behavior?
toWarnDev
should pass the expected values intoa
, the actual (received) values intob
ofjestDiff
:The text was updated successfully, but these errors were encountered: