Skip to content

Commit d330f77

Browse files
feat(breaking): upgrade to Jest 25 (#110)
* fix(package): update pretty-format to version 25.1.0 * fix(package): update jest-snapshot to version 25.1.0 * fix(package): update jest-diff to version 25.1.0 * chore(package): update lockfile yarn.lock * update imports and undefined testName Co-authored-by: Michał Pierzchała <[email protected]>
1 parent e4a903e commit d330f77

File tree

5 files changed

+581
-22
lines changed

5 files changed

+581
-22
lines changed

__tests__/__snapshots__/snapshotDiff.test.js.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ exports[`can colorize diff 1`] = `
1515
 very
1616
 long
1717
 script
18-
[2m [22m"
18+
"
1919
`;
2020

2121
exports[`can expand diff 1`] = `
2222
"Snapshot Diff:
2323
- First value
2424
+ Second value
2525
26-
26+
2727
some
2828
some
2929
some
@@ -36,7 +36,7 @@ exports[`can expand diff 1`] = `
3636
very
3737
long
3838
script
39-
"
39+
"
4040
`;
4141

4242
exports[`can use contextLines on diff 1`] = `
@@ -92,7 +92,7 @@ exports[`can use stablePatchmarks on diff 1`] = `
9292
@very
9393
@long
9494
@script
95-
"
95+
"
9696
`;
9797

9898
exports[`collapses diffs and strips ansi by default 1`] = `
@@ -110,7 +110,7 @@ exports[`collapses diffs and strips ansi by default 1`] = `
110110
very
111111
long
112112
script
113-
"
113+
"
114114
`;
115115

116116
exports[`detects React components 1`] = `
@@ -155,7 +155,7 @@ exports[`diffs short strings 1`] = `
155155
- First value
156156
+ Second value
157157
158-
158+
159159
- abcx
160160
+ abcy
161161
"

__tests__/__snapshots__/toMatchDiffSnapshot.test.js.snap

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exports[`proxies "colors" option(s) 1`] = `
1515
 very
1616
 long
1717
 script
18-
[2m [22m"
18+
"
1919
`;
2020

2121
exports[`proxies "contextLines" option(s) 1`] = `
@@ -32,7 +32,7 @@ exports[`proxies "expand" option(s) 1`] = `
3232
- First value
3333
+ Second value
3434
35-
35+
3636
some
3737
some
3838
some
@@ -45,7 +45,7 @@ exports[`proxies "expand" option(s) 1`] = `
4545
very
4646
long
4747
script
48-
"
48+
"
4949
`;
5050

5151
exports[`works with custom name: slim 1`] = `
@@ -63,7 +63,7 @@ exports[`works with custom name: slim 1`] = `
6363
very
6464
long
6565
script
66-
"
66+
"
6767
`;
6868

6969
exports[`works with default options 1`] = `
@@ -81,5 +81,5 @@ exports[`works with default options 1`] = `
8181
very
8282
long
8383
script
84-
"
84+
"
8585
`;

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"jest": ">=16"
2020
},
2121
"dependencies": {
22-
"jest-diff": "^24.0.0",
23-
"jest-snapshot": "^24.0.0",
24-
"pretty-format": "^24.0.0",
22+
"jest-diff": "^25.1.0",
23+
"jest-snapshot": "^25.1.0",
24+
"pretty-format": "^25.1.0",
2525
"strip-ansi": "^6.0.0"
2626
},
2727
"devDependencies": {

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
const diff = require('jest-diff');
5+
const diff = require('jest-diff').default;
66
const snapshot = require('jest-snapshot');
77
const reactSerializer = require('./react-serializer');
88

@@ -84,7 +84,7 @@ function toMatchDiffSnapshot(
8484
) {
8585
const difference = snapshotDiff(valueA, valueB, options);
8686

87-
return snapshot.toMatchSnapshot.call(this, difference, testName);
87+
return snapshot.toMatchSnapshot.call(this, difference, testName || '');
8888
}
8989

9090
function getSnapshotDiffSerializer() {

0 commit comments

Comments
 (0)