diff --git a/.editorconfig b/.editorconfig index 5f5b1286231..b50253df1f1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,7 +18,7 @@ trim_trailing_whitespace = true indent_size = 4 [package.json] -indent_size = 4 +indent_size = 2 [*.tsx.snap] trim_trailing_whitespace = false diff --git a/.prettierignore b/.prettierignore index 1db987bec4e..0cca8fb6aa6 100644 --- a/.prettierignore +++ b/.prettierignore @@ -37,10 +37,5 @@ package-lock.json # Downloaded and already minified res/jitsi_external_api.min.js - -/playwright/test-results/ -/playwright/html-report/ -/playwright/logs/ -/playwright/snapshots/ # This file is also machine-generated /playwright/e2e/crypto/test_indexeddb_cryptostore_dump/dump.json diff --git a/jest.config.ts b/jest.config.ts index 4f75eb04db4..9cc320d6ea6 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -44,8 +44,6 @@ const config: Config = { // getSessionLock is piped into a different JS context via stringification, and the coverage functionality is // not available in that contest. So, turn off coverage instrumentation for it. "!/src/utils/SessionLock.ts", - // Coverage chokes on type definition files - "!/src/**/*.d.ts", ], coverageReporters: ["text-summary", "lcov"], testResultsProcessor: "@casualbot/jest-sonar-reporter", diff --git a/package.json b/package.json index 8b56bb35706..4ab26bb1dfd 100644 --- a/package.json +++ b/package.json @@ -74,8 +74,12 @@ "update:jitsi": "curl -s https://meet.element.io/libs/external_api.min.js > ./res/jitsi_external_api.min.js" }, "resolutions": { + "@types/seedrandom": "3.0.8", + "oidc-client-ts": "3.1.0", "jwt-decode": "4.0.0", - "caniuse-lite": "1.0.30001668" + "caniuse-lite": "1.0.30001668", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0", + "wrap-ansi": "npm:wrap-ansi@^7.0.0" }, "dependencies": { "@babel/runtime": "^7.12.5", @@ -250,8 +254,8 @@ "html-webpack-plugin": "^5.5.3", "husky": "^9.0.0", "jest": "^29.6.2", - "jest-environment-jsdom": "^29.7.0", "jest-canvas-mock": "^2.5.2", + "jest-environment-jsdom": "^29.7.0", "jest-mock": "^29.6.2", "jest-raw-loader": "^1.0.1", "jsqr": "^1.4.0", diff --git a/playwright/.gitignore b/playwright/.gitignore index 7f8619da7d7..0d50077f5ad 100644 --- a/playwright/.gitignore +++ b/playwright/.gitignore @@ -4,5 +4,3 @@ # Only commit snapshots from Linux /snapshots/**/*.png !/snapshots/**/*-linux.png -# This file is also machine-generated -/e2e/crypto/test_indexeddb_cryptostore_dump/dump.json diff --git a/test/test-utils/utilities.ts b/test/test-utils/utilities.ts index 5d42572aa07..4278b73f74d 100644 --- a/test/test-utils/utilities.ts +++ b/test/test-utils/utilities.ts @@ -119,7 +119,7 @@ export function untilEmission( }); } -export const flushPromises = async () => await new Promise((resolve) => window.setTimeout(resolve, 10)); +export const flushPromises = async () => await new Promise((resolve) => window.setTimeout(resolve)); // with jest's modern fake timers process.nextTick is also mocked, // flushing promises in the normal way then waits for some advancement diff --git a/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx b/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx index 88333b13b8e..b0ee3531e2a 100644 --- a/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx +++ b/test/unit-tests/components/views/dialogs/security/ExportE2eKeysDialog-test.tsx @@ -35,9 +35,10 @@ describe("ExportE2eKeysDialog", () => { const cli = createTestClient(); const onFinished = jest.fn(); - render(); + const { container } = render(); const input = screen.getByLabelText("Enter passphrase"); await userEvent.type(input, "password"); + fireEvent.click(container.querySelector("[type=submit]")!); await expect(screen.findByText("This is a top-10 common password")).resolves.toBeInTheDocument(); }); diff --git a/test/unit-tests/components/views/rooms/MemberList-test.tsx b/test/unit-tests/components/views/rooms/MemberList-test.tsx index d21d2d41f1b..3e17f7ce862 100644 --- a/test/unit-tests/components/views/rooms/MemberList-test.tsx +++ b/test/unit-tests/components/views/rooms/MemberList-test.tsx @@ -398,12 +398,10 @@ describe("MemberList", () => { jest.spyOn(room, "canInvite").mockReturnValue(false); renderComponent(); - await act(flushPromises); + await flushPromises(); // button rendered but disabled - const button = document.querySelector(".mx_MemberList_invite"); - expect(button).toHaveTextContent("Invite to this room"); - expect(button).toHaveAttribute("aria-disabled", "true"); + expect(screen.getByText("Invite to this room")).toHaveAttribute("aria-disabled", "true"); }); it("renders enabled invite button when current user is a member and has rights to invite", async () => { diff --git a/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx b/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx index d628674b6f6..a224e117bd3 100644 --- a/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx +++ b/test/unit-tests/components/views/settings/tabs/user/SessionManagerTab-test.tsx @@ -1038,7 +1038,7 @@ describe("", () => { fireEvent.submit(getByLabelText("Password")); }); - await flushPromises(); + await act(flushPromises); // called again with auth expect(mockClient.deleteMultipleDevices).toHaveBeenCalledWith([alicesMobileDevice.device_id], { diff --git a/test/unit-tests/languageHandler-test.tsx b/test/unit-tests/languageHandler-test.tsx index e3ab9090f82..90360ed56e6 100644 --- a/test/unit-tests/languageHandler-test.tsx +++ b/test/unit-tests/languageHandler-test.tsx @@ -136,6 +136,7 @@ describe("languageHandler", () => { const friendlyError = new UserFriendlyError(testErrorMessage, { email: "test@example.com", + cause: undefined, }); // Ensure message is in English so it's readable in the logs @@ -151,8 +152,8 @@ describe("languageHandler", () => { const underlyingError = new Error("Fake underlying error"); const friendlyError = new UserFriendlyError(testErrorMessage, { - cause: underlyingError, email: "test@example.com", + cause: underlyingError, }); expect(friendlyError.cause).toStrictEqual(underlyingError); diff --git a/yarn.lock b/yarn.lock index dea5015284c..abaa6cc782e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3681,7 +3681,7 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== -ansi-styles@^6.0.0, ansi-styles@^6.1.0, ansi-styles@^6.2.1: +ansi-styles@^6.0.0, ansi-styles@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== @@ -8733,7 +8733,7 @@ obuf@^1.0.0, obuf@^1.1.2: resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== -oidc-client-ts@^3.0.1: +oidc-client-ts@3.1.0, oidc-client-ts@^3.0.1: version "3.1.0" resolved "https://registry.yarnpkg.com/oidc-client-ts/-/oidc-client-ts-3.1.0.tgz#28d3254951a1c64cc9780042c61492a71b2240dd" integrity sha512-IDopEXjiwjkmJLYZo6BTlvwOtnlSniWZkKZoXforC/oLZHC9wkIxd25Kwtmo5yKFMMVcsp3JY6bhcNJqdYk8+g== @@ -10850,7 +10850,7 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^5.0.1, string-width@^5.1.2: +string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== @@ -12049,16 +12049,7 @@ word-wrap@^1.2.5: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +wrap-ansi@^6.2.0, wrap-ansi@^7.0.0, wrap-ansi@^8.1.0, wrap-ansi@^9.0.0, "wrap-ansi@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -12067,24 +12058,6 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - -wrap-ansi@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.0.tgz#1a3dc8b70d85eeb8398ddfb1e4a02cd186e58b3e" - integrity sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q== - dependencies: - ansi-styles "^6.2.1" - string-width "^7.0.0" - strip-ansi "^7.1.0" - wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"