mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
`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
This commit is contained in:
@@ -49,11 +49,11 @@ const createMatcherFor = consoleMethod =>
|
||||
} else if (expectedMessages.length === 1) {
|
||||
errorMessage =
|
||||
'Unexpected warning recorded: ' +
|
||||
jestDiff(normalizedMessage, expectedMessages[0]);
|
||||
jestDiff(expectedMessages[0], normalizedMessage);
|
||||
} else {
|
||||
errorMessage =
|
||||
'Unexpected warning recorded: ' +
|
||||
jestDiff([normalizedMessage], expectedMessages);
|
||||
jestDiff(expectedMessages, [normalizedMessage]);
|
||||
}
|
||||
|
||||
// Record the call stack for unexpected warnings.
|
||||
|
||||
Reference in New Issue
Block a user