From bc336abf475dca54ab000ea23f3911482d7b8f6d Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk <3636685+Palid@users.noreply.github.com> Date: Wed, 13 Oct 2021 12:09:43 +0200 Subject: [PATCH] Fix missing snapshot serializer&enzyme init (#6932) --- package.json | 3 ++ test/accessibility/RovingTabIndex-test.js | 5 +-- .../structures/MessagePanel-test.js | 5 +-- .../views/dialogs/ForwardDialog-test.js | 5 +-- .../views/messages/TextualBody-test.js | 5 +-- .../views/rooms/SendMessageComposer-test.tsx | 5 +-- test/setupTests.js | 5 +++ yarn.lock | 34 ++++++++++++++++--- 8 files changed, 42 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 599f61dc38..c601072126 100644 --- a/package.json +++ b/package.json @@ -134,6 +134,7 @@ "@types/counterpart": "^0.18.1", "@types/css-font-loading-module": "^0.0.6", "@types/diff-match-patch": "^1.0.32", + "@types/enzyme": "^3.10.9", "@types/file-saver": "^2.0.3", "@types/flux": "^3.1.9", "@types/jest": "^26.0.20", @@ -158,6 +159,7 @@ "chokidar": "^3.5.1", "concurrently": "^5.3.0", "enzyme": "^3.11.0", + "enzyme-to-json": "^3.6.2", "eslint": "7.18.0", "eslint-config-google": "^0.14.0", "eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#2306b3d4da4eba908b256014b979f1d3d43d2945", @@ -186,6 +188,7 @@ "@types/react": "17.0.14" }, "jest": { + "snapshotSerializers": ["enzyme-to-json/serializer"], "testEnvironment": "./__test-utils__/environment.js", "testMatch": [ "/test/**/*-test.[jt]s?(x)" diff --git a/test/accessibility/RovingTabIndex-test.js b/test/accessibility/RovingTabIndex-test.js index 72d4253710..861aeaf9d7 100644 --- a/test/accessibility/RovingTabIndex-test.js +++ b/test/accessibility/RovingTabIndex-test.js @@ -16,8 +16,7 @@ limitations under the License. import '../skinned-sdk'; // Must be first for skinning to work import React from "react"; -import Adapter from "@wojtekmaj/enzyme-adapter-react-17"; -import { configure, mount } from "enzyme"; +import { mount } from "enzyme"; import { RovingTabIndexProvider, @@ -25,8 +24,6 @@ import { useRovingTabIndex, } from "../../src/accessibility/RovingTabIndex"; -configure({ adapter: new Adapter() }); - const Button = (props) => { const [onFocus, isActive, ref] = useRovingTabIndex(); return