Fix missing snapshot serializer&enzyme init (#6932)
This commit is contained in:
parent
3417c03f41
commit
bc336abf47
8 changed files with 42 additions and 25 deletions
|
@ -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": [
|
||||
"<rootDir>/test/**/*-test.[jt]s?(x)"
|
||||
|
|
|
@ -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 <button {...props} onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref} />;
|
||||
|
|
|
@ -32,15 +32,12 @@ import Matrix from 'matrix-js-sdk';
|
|||
const TestUtilsMatrix = require('../../test-utils');
|
||||
import FakeTimers from '@sinonjs/fake-timers';
|
||||
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import MatrixClientContext from "../../../src/contexts/MatrixClientContext";
|
||||
import RoomContext from "../../../src/contexts/RoomContext";
|
||||
import DMRoomMap from "../../../src/utils/DMRoomMap";
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
let client;
|
||||
const room = new Matrix.Room("!roomId:server_name");
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ limitations under the License.
|
|||
import "../../../skinned-sdk";
|
||||
|
||||
import React from "react";
|
||||
import { configure, mount } from "enzyme";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { mount } from "enzyme";
|
||||
import { act } from "react-dom/test-utils";
|
||||
|
||||
import * as TestUtils from "../../../test-utils";
|
||||
|
@ -27,8 +26,6 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
|||
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
|
||||
import ForwardDialog from "../../../../src/components/views/dialogs/ForwardDialog";
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe("ForwardDialog", () => {
|
||||
const sourceRoom = "!111111111111111111:example.org";
|
||||
const defaultMessage = TestUtils.mkMessage({
|
||||
|
|
|
@ -15,8 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React from "react";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
import { mount } from "enzyme";
|
||||
|
||||
import sdk from "../../../skinned-sdk";
|
||||
import { mkEvent, mkStubRoom } from "../../../test-utils";
|
||||
|
@ -28,8 +27,6 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
|
|||
const _TextualBody = sdk.getComponent("views.messages.TextualBody");
|
||||
const TextualBody = TestUtils.wrapInMatrixClientContext(_TextualBody);
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe("<TextualBody />", () => {
|
||||
afterEach(() => {
|
||||
MatrixClientPeg.matrixClient = null;
|
||||
|
|
|
@ -15,11 +15,10 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import '../../../skinned-sdk'; // Must be first for skinning to work
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure, mount } from "enzyme";
|
||||
import React from "react";
|
||||
import { act } from "react-dom/test-utils";
|
||||
import { sleep } from "matrix-js-sdk/src/utils";
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import SendMessageComposer, {
|
||||
createMessageContent,
|
||||
|
@ -40,8 +39,6 @@ import { Layout } from '../../../../src/settings/Layout';
|
|||
|
||||
jest.mock("../../../../src/stores/RoomViewStore");
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
describe('<SendMessageComposer/>', () => {
|
||||
const roomContext = {
|
||||
roomLoading: true,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import * as languageHandler from "../src/languageHandler";
|
||||
import { TextEncoder, TextDecoder } from 'util';
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { configure } from "enzyme";
|
||||
|
||||
languageHandler.setLanguage('en');
|
||||
languageHandler.setMissingEntryGenerator(key => key.split("|", 2)[1]);
|
||||
|
@ -10,3 +12,6 @@ require('jest-fetch-mock').enableMocks();
|
|||
// view https://github.com/facebook/jest/issues/9983
|
||||
global.TextEncoder = TextEncoder;
|
||||
global.TextDecoder = TextDecoder;
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
|
|
34
yarn.lock
34
yarn.lock
|
@ -1607,6 +1607,13 @@
|
|||
dependencies:
|
||||
"@babel/types" "^7.3.0"
|
||||
|
||||
"@types/cheerio@*", "@types/cheerio@^0.22.22":
|
||||
version "0.22.30"
|
||||
resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.30.tgz#6c1ded70d20d890337f0f5144be2c5e9ce0936e6"
|
||||
integrity sha512-t7ZVArWZlq3dFa9Yt33qFBQIK4CQd1Q3UJp0V+UhP6vgLWLM6Qug7vZuRSGXg45zXeB1Fm5X2vmBkEX58LV2Tw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/classnames@^2.2.11":
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/classnames/-/classnames-2.3.1.tgz#3c2467aa0f1a93f1f021e3b9bcf938bd5dfdc0dd"
|
||||
|
@ -1634,6 +1641,14 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/diff-match-patch/-/diff-match-patch-1.0.32.tgz#d9c3b8c914aa8229485351db4865328337a3d09f"
|
||||
integrity sha512-bPYT5ECFiblzsVzyURaNhljBH2Gh1t9LowgUwciMrNAhFewLkHT2H0Mto07Y4/3KCOGZHRQll3CTtQZ0X11D/A==
|
||||
|
||||
"@types/enzyme@^3.10.9":
|
||||
version "3.10.9"
|
||||
resolved "https://registry.yarnpkg.com/@types/enzyme/-/enzyme-3.10.9.tgz#b2d7c7429a37d994c156b6f361e83f271a60c8aa"
|
||||
integrity sha512-dx5UvcWe2Vtye6S9Hw2rFB7Ul9uMXOAje2FAbXvVYieQDNle9qPAo7DfvFMSztZ9NFiD3dVZ4JsRYGTrSLynJg==
|
||||
dependencies:
|
||||
"@types/cheerio" "*"
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/events@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
|
||||
|
@ -3355,6 +3370,15 @@ enzyme-shallow-equal@^1.0.0, enzyme-shallow-equal@^1.0.1:
|
|||
has "^1.0.3"
|
||||
object-is "^1.1.2"
|
||||
|
||||
enzyme-to-json@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/enzyme-to-json/-/enzyme-to-json-3.6.2.tgz#94f85c413bcae8ab67be53b0a94b69a560e27823"
|
||||
integrity sha512-Ynm6Z6R6iwQ0g2g1YToz6DWhxVnt8Dy1ijR2zynRKxTyBGA8rCDXU3rs2Qc4OKvUvc2Qoe1bcFK6bnPs20TrTg==
|
||||
dependencies:
|
||||
"@types/cheerio" "^0.22.22"
|
||||
lodash "^4.17.21"
|
||||
react-is "^16.12.0"
|
||||
|
||||
enzyme@^3.11.0:
|
||||
version "3.11.0"
|
||||
resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.11.0.tgz#71d680c580fe9349f6f5ac6c775bc3e6b7a79c28"
|
||||
|
@ -6917,16 +6941,16 @@ react-focus-lock@^2.5.0:
|
|||
use-callback-ref "^1.2.5"
|
||||
use-sidecar "^1.0.5"
|
||||
|
||||
react-is@^16.12.0, react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||
|
||||
"react-is@^16.12.0 || ^17.0.0", react-is@^17.0.1, react-is@^17.0.2:
|
||||
version "17.0.2"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
|
||||
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
|
||||
|
||||
react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1:
|
||||
version "16.13.1"
|
||||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
|
||||
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
|
||||
|
||||
react-redux@^7.2.0:
|
||||
version "7.2.5"
|
||||
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.2.5.tgz#213c1b05aa1187d9c940ddfc0b29450957f6a3b8"
|
||||
|
|
Loading…
Reference in a new issue