Skip to content

Commit

Permalink
Update jest-diff to remove colors from no diff message
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alistairjcbrown committed Jun 24, 2020
1 parent 2c32732 commit 30fd0b0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions __tests__/__snapshots__/snapshotDiff.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ exports[`failed optional deps throws with sensible message on missing react-test
Cannot find module 'non-existent-module-for-testing' from '__tests__/snapshotDiff.test.js'"
`;

exports[`no difference 1`] = `
"Snapshot Diff:
Compared values have no visual difference."
`;

exports[`shows diff when comparing React fragments of varying length 1`] = `
"Snapshot Diff:
- <FragmentComponent />
Expand Down
4 changes: 4 additions & 0 deletions __tests__/snapshotDiff.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,7 @@ describe('failed optional deps', () => {
).toThrowErrorMatchingSnapshot();
});
});

test('no difference', () => {
expect(snapshotDiff('a', 'a')).toMatchSnapshot();
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"jest": ">=16"
},
"dependencies": {
"jest-diff": "^26.0.1",
"jest-diff": "^26.1.0",
"jest-snapshot": "^26.0.1",
"pretty-format": "^26.0.1"
},
Expand Down
30 changes: 30 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,16 @@
"@types/yargs" "^15.0.0"
chalk "^4.0.0"

"@jest/types@^26.1.0":
version "26.1.0"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.1.0.tgz#f8afaaaeeb23b5cad49dd1f7779689941dcb6057"
integrity sha512-GXigDDsp6ZlNMhXQDeuy/iYCDsRIHJabWtDzvnn36+aqFfG14JmFV0e/iXxY4SP9vbXSiPNOWdehU5MeqrYHBQ==
dependencies:
"@types/istanbul-lib-coverage" "^2.0.0"
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^15.0.0"
chalk "^4.0.0"

"@sinonjs/commons@^1.7.0":
version "1.7.2"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.2.tgz#505f55c74e0272b43f6c52d81946bed7058fc0e2"
Expand Down Expand Up @@ -3628,6 +3638,16 @@ jest-diff@^26.0.1:
jest-get-type "^26.0.0"
pretty-format "^26.0.1"

jest-diff@^26.1.0:
version "26.1.0"
resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.1.0.tgz#00a549bdc936c9691eb4dc25d1fbd78bf456abb2"
integrity sha512-GZpIcom339y0OXznsEKjtkfKxNdg7bVbEofK8Q6MnevTIiR1jNhDWKhRX6X0SDXJlwn3dy59nZ1z55fLkAqPWg==
dependencies:
chalk "^4.0.0"
diff-sequences "^26.0.0"
jest-get-type "^26.0.0"
pretty-format "^26.1.0"

jest-docblock@^26.0.0:
version "26.0.0"
resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-26.0.0.tgz#3e2fa20899fc928cb13bd0ff68bd3711a36889b5"
Expand Down Expand Up @@ -4858,6 +4878,16 @@ pretty-format@^26.0.1:
ansi-styles "^4.0.0"
react-is "^16.12.0"

pretty-format@^26.1.0:
version "26.1.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.1.0.tgz#272b9cd1f1a924ab5d443dc224899d7a65cb96ec"
integrity sha512-GmeO1PEYdM+non4BKCj+XsPJjFOJIPnsLewqhDVoqY1xo0yNmDas7tC2XwpMrRAHR3MaE2hPo37deX5OisJ2Wg==
dependencies:
"@jest/types" "^26.1.0"
ansi-regex "^5.0.0"
ansi-styles "^4.0.0"
react-is "^16.12.0"

private@^0.1.6:
version "0.1.8"
resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff"
Expand Down

0 comments on commit 30fd0b0

Please sign in to comment.