From 112ab23968a62656dfa5d38f42b7318375ffa5fb Mon Sep 17 00:00:00 2001 From: Naz Date: Tue, 17 Jan 2023 11:12:26 +0800 Subject: [PATCH] Removed direct use of @tryghost/jest-snapshot refs https://github.com/TryGhost/Toolbox/issues/499 refs https://github.com/TryGhost/framework/commit/6bcc47a0ada70d1c14311d7c68dbef75096d04b8 - Using module directly caused issues with snapshots manager instance initialization (mocha hooks did not apply to a correct instance) - See refed commit for more --- ghost/core/package.json | 3 +-- ghost/core/test/utils/assertions.js | 2 +- yarn.lock | 22 ++++++---------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/ghost/core/package.json b/ghost/core/package.json index 8fa78dacdd..aa71434616 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -201,8 +201,7 @@ }, "devDependencies": { "@playwright/test": "1.29.2", - "@tryghost/express-test": "0.11.8", - "@tryghost/jest-snapshot": "0.5.0", + "@tryghost/express-test": "0.12.0", "@tryghost/webhook-mock-receiver": "0.2.3", "@types/common-tags": "1.8.1", "c8": "7.12.0", diff --git a/ghost/core/test/utils/assertions.js b/ghost/core/test/utils/assertions.js index 7d595003c1..0dc41c34a7 100644 --- a/ghost/core/test/utils/assertions.js +++ b/ghost/core/test/utils/assertions.js @@ -1,6 +1,6 @@ const should = require('should'); const errorProps = ['message', 'errorType']; -const {matchSnapshotAssertion} = require('@tryghost/jest-snapshot'); +const {matchSnapshotAssertion} = require('@tryghost/express-test').snapshot; should.Assertion.add('JSONErrorObject', function () { this.params = {operator: 'to be a valid JSON Error Object'}; diff --git a/yarn.lock b/yarn.lock index 703ba175b4..1840d31c66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4367,12 +4367,12 @@ lodash "^4.17.21" uuid "^9.0.0" -"@tryghost/express-test@0.11.8": - version "0.11.8" - resolved "https://registry.yarnpkg.com/@tryghost/express-test/-/express-test-0.11.8.tgz#96cd84e2746670bdc848c806137327d9a5ed1bcb" - integrity sha512-KyiaZc9/+cZCrSl6Ryc9Lt8MnPxbM0WX0kQ9W70LWZikJOX+Ae10FV1/JHa074kHne4dmXaW8vnl+uTO4zDLjw== +"@tryghost/express-test@0.12.0": + version "0.12.0" + resolved "https://registry.yarnpkg.com/@tryghost/express-test/-/express-test-0.12.0.tgz#0b96201cadffa615a32e13d225c4cb6871292f0c" + integrity sha512-hLtPj/GrjYo52mQpWhkPa386cEKZ2RrzwsHQmE3zfOu3PEqNlLB+4hf0J7SW4gpiHhBtEneytYvj20q2c75qIg== dependencies: - "@tryghost/jest-snapshot" "^0.4.8" + "@tryghost/jest-snapshot" "^0.5.0" cookiejar "^2.1.3" reqresnext "^1.7.0" @@ -4416,7 +4416,7 @@ optionalDependencies: sharp "^0.30.0" -"@tryghost/jest-snapshot@0.5.0": +"@tryghost/jest-snapshot@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@tryghost/jest-snapshot/-/jest-snapshot-0.5.0.tgz#1250a64ecadfecf3f2ab45d5077a9778f2c4ec25" integrity sha512-vw8bEYtIdui1+j4XrR+4HsD6bu2B8MdzImVvawAnxAoPO5fODYe/wWXKNKvraPdpe9pgNQOClQxm9QAF6y8jSw== @@ -4426,16 +4426,6 @@ "@tryghost/errors" "^1.2.20" jest-snapshot "^29.0.0" -"@tryghost/jest-snapshot@^0.4.8": - version "0.4.8" - resolved "https://registry.yarnpkg.com/@tryghost/jest-snapshot/-/jest-snapshot-0.4.8.tgz#434ce54774334af78e6654b2f7be0bb3c87d7af5" - integrity sha512-bLF0QIE60+ilHi51BHvR8en5gGBnC4VU2jmksIdhQZywlRTLCvYQpxyraSjsUeq5ou5gGHPRChpA/TyvmWLWzg== - dependencies: - "@jest/expect" "^28.0.1" - "@jest/expect-utils" "^28.0.1" - "@tryghost/errors" "^1.2.20" - jest-snapshot "^29.0.0" - "@tryghost/kg-card-factory@4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@tryghost/kg-card-factory/-/kg-card-factory-4.0.0.tgz#01212a872cbac937aa11b13c904442fa369abbc8"