@tryghost/jest-snapshot 0.3.12 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/jest-snapshot.js +2 -2
- package/lib/snapshot-manager.js +2 -14
- package/package.json +7 -6
package/lib/jest-snapshot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const {jestExpect} = require('@jest/expect');
|
|
2
2
|
const SnapshotManager = require('./snapshot-manager');
|
|
3
3
|
const snapshotManager = new SnapshotManager();
|
|
4
4
|
|
|
@@ -25,7 +25,7 @@ const mochaHooks = {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const {any, anything, stringMatching} =
|
|
28
|
+
const {any, anything, stringMatching} = jestExpect;
|
|
29
29
|
|
|
30
30
|
module.exports = {
|
|
31
31
|
mochaHooks,
|
package/lib/snapshot-manager.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const {SnapshotState, toMatchSnapshot} = require('jest-snapshot');
|
|
2
2
|
const errors = require('@tryghost/errors');
|
|
3
|
-
const
|
|
4
|
-
const utils = require('expect/build/utils');
|
|
3
|
+
const utils = require('@jest/expect-utils');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
|
|
7
6
|
class SnapshotManageer {
|
|
@@ -76,22 +75,11 @@ class SnapshotManageer {
|
|
|
76
75
|
const {testFile, snapshotName, willUpdate} = this._getConfig();
|
|
77
76
|
|
|
78
77
|
const snapshotState = this.getSnapshotState(testFile, willUpdate);
|
|
79
|
-
// Equals is not exposed from the internals of expect
|
|
80
|
-
// This truly bananananas workaround comes from here: https://github.com/facebook/jest/issues/11867
|
|
81
|
-
let equals = null;
|
|
82
|
-
expect.extend({
|
|
83
|
-
__capture_equals__() {
|
|
84
|
-
equals = this.equals;
|
|
85
|
-
return {pass: true};
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
expect().__capture_equals__();
|
|
89
|
-
|
|
90
78
|
const matcher = toMatchSnapshot.bind({
|
|
91
79
|
snapshotState,
|
|
92
80
|
currentTestName: snapshotName,
|
|
93
81
|
utils,
|
|
94
|
-
equals
|
|
82
|
+
equals: utils.equals
|
|
95
83
|
});
|
|
96
84
|
|
|
97
85
|
// Execute the matcher
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/jest-snapshot",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"repository": "https://github.com/TryGhost/framework/tree/main/packages/jest-snapshot",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,15 +19,16 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"c8": "7.11.
|
|
22
|
+
"c8": "7.11.2",
|
|
23
23
|
"mocha": "9.2.2",
|
|
24
24
|
"should": "13.2.3",
|
|
25
25
|
"sinon": "13.0.2"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"expect": "^
|
|
30
|
-
"
|
|
28
|
+
"@jest/expect": "^28.0.1",
|
|
29
|
+
"@jest/expect-utils": "^28.0.1",
|
|
30
|
+
"@tryghost/errors": "^1.2.12",
|
|
31
|
+
"jest-snapshot": "^28.0.0"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "944b81c690bc66f703c8cf36a310e51ce5393b9f"
|
|
33
34
|
}
|