diff --git a/CHANGELOG.md b/CHANGELOG.md index f54f01397e32..b68bdb936a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Features +* `[jest-matcher-utils]` Change "suggest to equal" message to be more advisory + ([#6103](https://github.com/facebook/jest/issues/6103)) * `[jest-message-util]` Don't ignore messages with `vendor` anymore ([#6117](https://github.com/facebook/jest/pull/6117)) * `[jest-validate]` Get rid of `jest-config` dependency diff --git a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap index e77f3ee64c5a..711f01c60f77 100644 --- a/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap +++ b/packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap @@ -290,7 +290,7 @@ Received: [] Difference: -Compared values have no visual difference. Looks like you wanted to test for object/array equality with the stricter \`toBe\` matcher. You probably need to use \`toEqual\` instead." +Compared values have no visual difference. Note that you are testing for equality with the stricter \`toBe\` matcher using \`Object.is\`. For deep equality only, use \`toEqual\` instead." `; exports[`.toBe() fails for: {"a": 1} and {"a": 1} 1`] = ` @@ -301,7 +301,7 @@ Received: {\\"a\\": 1} Difference: -Compared values have no visual difference. Looks like you wanted to test for object/array equality with the stricter \`toBe\` matcher. You probably need to use \`toEqual\` instead." +Compared values have no visual difference. Note that you are testing for equality with the stricter \`toBe\` matcher using \`Object.is\`. For deep equality only, use \`toEqual\` instead." `; exports[`.toBe() fails for: {"a": 1} and {"a": 5} 1`] = ` @@ -329,7 +329,7 @@ Received: {} Difference: -Compared values have no visual difference. Looks like you wanted to test for object/array equality with the stricter \`toBe\` matcher. You probably need to use \`toEqual\` instead." +Compared values have no visual difference. Note that you are testing for equality with the stricter \`toBe\` matcher using \`Object.is\`. For deep equality only, use \`toEqual\` instead." `; exports[`.toBe() fails for: -0 and 0 1`] = ` diff --git a/packages/jest-matcher-utils/src/index.js b/packages/jest-matcher-utils/src/index.js index 8123394744dc..232b0e33cba9 100644 --- a/packages/jest-matcher-utils/src/index.js +++ b/packages/jest-matcher-utils/src/index.js @@ -49,7 +49,7 @@ const NUMBERS = [ ]; export const SUGGEST_TO_EQUAL = chalk.dim( - 'Looks like you wanted to test for object/array equality with the stricter `toBe` matcher. You probably need to use `toEqual` instead.', + 'Note that you are testing for equality with the stricter `toBe` matcher using `Object.is`. For deep equality only, use `toEqual` instead.', ); export const SUGGEST_TO_CONTAIN_EQUAL = chalk.dim(