From 8ba54f5f7d7227b8de0a2809bab7a0f4dc4ae231 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 18 Jan 2020 01:38:22 +0000 Subject: [PATCH 1/2] Don't use expect and jest-mock anymore as they're implicit from jest Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- test/components/views/messages/TextualBody-test.js | 1 - test/components/views/rooms/RoomSettings-test.js | 1 - 2 files changed, 2 deletions(-) diff --git a/test/components/views/messages/TextualBody-test.js b/test/components/views/messages/TextualBody-test.js index 755751ffb7..180a2f7e54 100644 --- a/test/components/views/messages/TextualBody-test.js +++ b/test/components/views/messages/TextualBody-test.js @@ -15,7 +15,6 @@ limitations under the License. */ import React from "react"; -import expect from 'expect'; import Adapter from "enzyme-adapter-react-16"; import { configure, mount } from "enzyme"; diff --git a/test/components/views/rooms/RoomSettings-test.js b/test/components/views/rooms/RoomSettings-test.js index 21d22a964c..870d7f0aab 100644 --- a/test/components/views/rooms/RoomSettings-test.js +++ b/test/components/views/rooms/RoomSettings-test.js @@ -1,7 +1,6 @@ // TODO: Rewrite room settings tests for dialog support import React from 'react'; import ReactDOM from 'react-dom'; -import jest from 'jest-mock'; import * as testUtils from '../../../test-utils'; import sdk from '../../../skinned-sdk'; import {MatrixClientPeg} from '../../../../src/MatrixClientPeg'; From 9365a9cb3040e8d7d0d7652175ec52ac8dce1d2e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 18 Jan 2020 01:39:14 +0000 Subject: [PATCH 2/2] Remove lolex where its not needed and move to dev-deps. Remove unused optimist Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- package.json | 7 +++--- test/UserActivity-test.js | 5 ++--- .../components/views/rooms/MemberList-test.js | 6 ----- yarn.lock | 22 +++++++++++++++---- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 3686966870..d5f56aded0 100644 --- a/package.json +++ b/package.json @@ -80,9 +80,7 @@ "isomorphic-fetch": "^2.2.1", "linkifyjs": "^2.1.6", "lodash": "^4.17.14", - "lolex": "4.2", "matrix-js-sdk": "3.0.0", - "optimist": "^0.6.1", "pako": "^1.0.5", "png-chunks-extract": "^1.0.0", "prop-types": "^15.5.8", @@ -138,6 +136,7 @@ "file-loader": "^3.0.1", "flow-parser": "^0.57.3", "jest": "^24.9.0", + "lolex": "^5.1.2", "matrix-mock-request": "^1.2.3", "matrix-react-test-utils": "^0.2.2", "react-test-renderer": "^16.9.0", @@ -157,7 +156,9 @@ "testMatch": [ "/test/**/*-test.js" ], - "setupTestFrameworkScriptFile": "/test/setupTests.js", + "setupFilesAfterEnv": [ + "/test/setupTests.js" + ], "moduleNameMapper": { "\\.(gif|png|svg|ttf|woff2)$": "/__mocks__/imageMock.js", "\\$webapp/i18n/languages.json": "/__mocks__/languages.json" diff --git a/test/UserActivity-test.js b/test/UserActivity-test.js index a30df527ae..1b0fbafb48 100644 --- a/test/UserActivity-test.js +++ b/test/UserActivity-test.js @@ -15,7 +15,6 @@ limitations under the License. */ import lolex from 'lolex'; -import jest from 'jest-mock'; import EventEmitter from 'events'; import UserActivity from '../src/UserActivity'; @@ -36,8 +35,8 @@ describe('UserActivity', function() { let clock; beforeEach(function() { - fakeWindow = new FakeDomEventEmitter(), - fakeDocument = new FakeDomEventEmitter(), + fakeWindow = new FakeDomEventEmitter(); + fakeDocument = new FakeDomEventEmitter(); userActivity = new UserActivity(fakeWindow, fakeDocument); userActivity.start(); clock = lolex.install(); diff --git a/test/components/views/rooms/MemberList-test.js b/test/components/views/rooms/MemberList-test.js index cac2c5287c..24b6391c93 100644 --- a/test/components/views/rooms/MemberList-test.js +++ b/test/components/views/rooms/MemberList-test.js @@ -1,7 +1,6 @@ import React from 'react'; import ReactTestUtils from 'react-dom/test-utils'; import ReactDOM from 'react-dom'; -import lolex from 'lolex'; import * as TestUtils from '../../../test-utils'; @@ -27,7 +26,6 @@ describe('MemberList', () => { let parentDiv = null; let client = null; let root = null; - let clock = null; let memberListRoom; let memberList = null; @@ -40,8 +38,6 @@ describe('MemberList', () => { client = MatrixClientPeg.get(); client.hasLazyLoadMembersEnabled = () => false; - clock = lolex.install(); - parentDiv = document.createElement('div'); document.body.appendChild(parentDiv); @@ -114,8 +110,6 @@ describe('MemberList', () => { parentDiv = null; } - clock.uninstall(); - done(); }); diff --git a/yarn.lock b/yarn.lock index 81602b4e3d..ce718c0900 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1137,6 +1137,13 @@ tslib "^1.10.0" webcrypto-core "^1.0.17" +"@sinonjs/commons@^1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.0.tgz#f90ffc52a2e519f018b13b6c4da03cbff36ebed6" + integrity sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg== + dependencies: + type-detect "4.0.8" + "@types/babel__core@^7.1.0": version "7.1.3" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.3.tgz#e441ea7df63cd080dfcd02ab199e6d16a735fc30" @@ -5610,10 +5617,12 @@ loglevel@^1.6.4: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.6.tgz#0ee6300cc058db6b3551fa1c4bf73b83bb771312" integrity sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ== -lolex@4.2: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lolex/-/lolex-4.2.0.tgz#ddbd7f6213ca1ea5826901ab1222b65d714b3cd7" - integrity sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg== +lolex@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-5.1.2.tgz#953694d098ce7c07bc5ed6d0e42bc6c0c6d5a367" + integrity sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A== + dependencies: + "@sinonjs/commons" "^1.7.0" longest-streak@^2.0.1: version "2.0.3" @@ -8580,6 +8589,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-detect@4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"