Skip to content

Commit 30fd0b0

Browse files
Update jest-diff to remove colors from no diff message
Updates to the latest jest-diff which now supports removing color codes from "no visual difference" message. A test has been added to confirm this and prevent regressions in the future. Fixes #129
1 parent 2c32732 commit 30fd0b0

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

__tests__/__snapshots__/snapshotDiff.test.js.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ exports[`failed optional deps throws with sensible message on missing react-test
166166
Cannot find module 'non-existent-module-for-testing' from '__tests__/snapshotDiff.test.js'"
167167
`;
168168

169+
exports[`no difference 1`] = `
170+
"Snapshot Diff:
171+
Compared values have no visual difference."
172+
`;
173+
169174
exports[`shows diff when comparing React fragments of varying length 1`] = `
170175
"Snapshot Diff:
171176
- <FragmentComponent />

__tests__/snapshotDiff.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,7 @@ describe('failed optional deps', () => {
267267
).toThrowErrorMatchingSnapshot();
268268
});
269269
});
270+
271+
test('no difference', () => {
272+
expect(snapshotDiff('a', 'a')).toMatchSnapshot();
273+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"jest": ">=16"
2323
},
2424
"dependencies": {
25-
"jest-diff": "^26.0.1",
25+
"jest-diff": "^26.1.0",
2626
"jest-snapshot": "^26.0.1",
2727
"pretty-format": "^26.0.1"
2828
},

yarn.lock

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,16 @@
11231123
"@types/yargs" "^15.0.0"
11241124
chalk "^4.0.0"
11251125

1126+
"@jest/types@^26.1.0":
1127+
version "26.1.0"
1128+
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.1.0.tgz#f8afaaaeeb23b5cad49dd1f7779689941dcb6057"
1129+
integrity sha512-GXigDDsp6ZlNMhXQDeuy/iYCDsRIHJabWtDzvnn36+aqFfG14JmFV0e/iXxY4SP9vbXSiPNOWdehU5MeqrYHBQ==
1130+
dependencies:
1131+
"@types/istanbul-lib-coverage" "^2.0.0"
1132+
"@types/istanbul-reports" "^1.1.1"
1133+
"@types/yargs" "^15.0.0"
1134+
chalk "^4.0.0"
1135+
11261136
"@sinonjs/commons@^1.7.0":
11271137
version "1.7.2"
11281138
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.2.tgz#505f55c74e0272b43f6c52d81946bed7058fc0e2"
@@ -3628,6 +3638,16 @@ jest-diff@^26.0.1:
36283638
jest-get-type "^26.0.0"
36293639
pretty-format "^26.0.1"
36303640

3641+
jest-diff@^26.1.0:
3642+
version "26.1.0"
3643+
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.1.0.tgz#00a549bdc936c9691eb4dc25d1fbd78bf456abb2"
3644+
integrity sha512-GZpIcom339y0OXznsEKjtkfKxNdg7bVbEofK8Q6MnevTIiR1jNhDWKhRX6X0SDXJlwn3dy59nZ1z55fLkAqPWg==
3645+
dependencies:
3646+
chalk "^4.0.0"
3647+
diff-sequences "^26.0.0"
3648+
jest-get-type "^26.0.0"
3649+
pretty-format "^26.1.0"
3650+
36313651
jest-docblock@^26.0.0:
36323652
version "26.0.0"
36333653
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5"
@@ -4858,6 +4878,16 @@ pretty-format@^26.0.1:
48584878
ansi-styles "^4.0.0"
48594879
react-is "^16.12.0"
48604880

4881+
pretty-format@^26.1.0:
4882+
version "26.1.0"
4883+
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.1.0.tgz#272b9cd1f1a924ab5d443dc224899d7a65cb96ec"
4884+
integrity sha512-GmeO1PEYdM+non4BKCj+XsPJjFOJIPnsLewqhDVoqY1xo0yNmDas7tC2XwpMrRAHR3MaE2hPo37deX5OisJ2Wg==
4885+
dependencies:
4886+
"@jest/types" "^26.1.0"
4887+
ansi-regex "^5.0.0"
4888+
ansi-styles "^4.0.0"
4889+
react-is "^16.12.0"
4890+
48614891
private@^0.1.6:
48624892
version "0.1.8"
48634893
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"

0 commit comments

Comments
 (0)