From b1b87bcba305fdffce8883c57f14382448993cc2 Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Tue, 31 Mar 2026 23:32:23 -0300 Subject: [PATCH 1/6] feat: upgrade typescript to v6 --- conf/tsconfig.content_scripts.json | 9 +- conf/tsconfig.streams.json | 4 +- conf/tsconfig.test.json | 5 + conf/tsconfig.tooling.json | 4 +- package-lock.json | 218 +++++++++++++++-------------- package.json | 4 +- tooling/resolve-modules.ts | 2 +- tooling/tsc-compiler.ts | 26 ++-- tsconfig.json | 31 ++-- 9 files changed, 154 insertions(+), 149 deletions(-) diff --git a/conf/tsconfig.content_scripts.json b/conf/tsconfig.content_scripts.json index 9af6178a6d2..233275f08a3 100644 --- a/conf/tsconfig.content_scripts.json +++ b/conf/tsconfig.content_scripts.json @@ -11,20 +11,21 @@ "noImplicitThis": true, "strictPropertyInitialization": false, "strictFunctionTypes": false, + "useUnknownInCatchVariables": false, "sourceMap": false, "checkJs": false, "moduleResolution": "bundler", + "rootDir": "../extension", "outDir": "../build/_/content_scripts", - "baseUrl": "../extension", "skipLibCheck": true, "paths": { "dompurify": ["../node_modules/dompurify/dist/purify.cjs.d.ts"], "openpgp": ["../node_modules/openpgp/openpgp.d.ts"], "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts"], "squire-rte": ["../node_modules/squire-rte/dist/types/Squire.d.ts"], - "undici-types": ["../node_modules/undici-types/index.d.ts", "COMMENT"], - "linkifyHtml": ["../node_modules/linkify-html/dist/linkify-html.d.mts", "COMMENT"], - "linkifyjs": ["../node_modules/linkifyjs/dist/linkify.d.mts", "COMMENT"] + "undici-types": ["../node_modules/undici-types/index.d.ts", "../COMMENT"], + "linkifyHtml": ["../node_modules/linkify-html/dist/linkify-html.d.mts", "../COMMENT"], + "linkifyjs": ["../node_modules/linkifyjs/dist/linkify.d.mts", "../COMMENT"] }, "typeRoots": ["../extension/types", "../extension/js/common/core/types"] }, diff --git a/conf/tsconfig.streams.json b/conf/tsconfig.streams.json index 31a4401494a..b10acb6a12f 100644 --- a/conf/tsconfig.streams.json +++ b/conf/tsconfig.streams.json @@ -10,8 +10,10 @@ "esModuleInterop": true, "module": "commonjs", "sourceMap": true, + "rootDir": "../node_modules/@openpgp/web-stream-tools/lib", "outDir": "../build/streams", - "skipLibCheck": true + "skipLibCheck": true, + "types": ["node"] }, "include": ["../node_modules/@openpgp/web-stream-tools/lib/*.js"] } diff --git a/conf/tsconfig.test.json b/conf/tsconfig.test.json index 20c220c2cb8..aa4800080f8 100644 --- a/conf/tsconfig.test.json +++ b/conf/tsconfig.test.json @@ -5,12 +5,17 @@ "alwaysStrict": true, "noImplicitAny": true, "strictNullChecks": true, + "strictPropertyInitialization": false, + "strictFunctionTypes": false, + "useUnknownInCatchVariables": false, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "module": "commonjs", "sourceMap": true, + "rootDir": "..", "outDir": "../build/test", "skipLibCheck": true, + "types": ["node", "chrome", "jquery"], "paths": { "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts", "../build/generic-extension-wip/lib/streams_common.js"] } diff --git a/conf/tsconfig.tooling.json b/conf/tsconfig.tooling.json index d49342cc5b9..12b769dca7a 100644 --- a/conf/tsconfig.tooling.json +++ b/conf/tsconfig.tooling.json @@ -7,8 +7,10 @@ "strictNullChecks": true, "module": "commonjs", "sourceMap": false, + "rootDir": "../tooling", "outDir": "../build/tooling", - "skipLibCheck": true + "skipLibCheck": true, + "types": ["node", "chrome", "thunderbird-webext-browser"] }, "files": [ "../tooling/build-types-and-manifests.ts", diff --git a/package-lock.json b/package-lock.json index 6d1495f784b..07779632258 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,8 +60,8 @@ "puppeteer": "24.40.0", "stylelint": "17.5.0", "stylelint-config-standard": "40.0.0", - "typescript": "5.9.3", - "typescript-eslint": "8.57.1", + "typescript": "6.0.2", + "typescript-eslint": "8.58.0", "undici-types": "^7.24.5", "web-ext": "10.0.0", "webpack-cli": "^7.0.2" @@ -218,9 +218,9 @@ } }, "node_modules/@csstools/css-syntax-patches-for-csstree": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.1.tgz", - "integrity": "sha512-BvqN0AMWNAnLk9G8jnUT77D+mUbY/H2b3uDTvg2isJkHaOufUE2R3AOwxWo7VBQKT1lOdwdvorddo2B/lk64+w==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.2.tgz", + "integrity": "sha512-5GkLzz4prTIpoyeUiIu3iV6CSG3Plo7xRVOFPKI7FVEJ3mZ0A8SwK0XU3Gl7xAkiQ+mDyam+NNp875/C5y+jSA==", "dev": true, "funding": [ { @@ -1653,20 +1653,20 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.57.1.tgz", - "integrity": "sha512-Gn3aqnvNl4NGc6x3/Bqk1AOn0thyTU9bqDRhiRnUWezgvr2OnhYCWCgC8zXXRVqBsIL1pSDt7T9nJUe0oM0kDQ==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.58.0.tgz", + "integrity": "sha512-RLkVSiNuUP1C2ROIWfqX+YcUfLaSnxGE/8M+Y57lopVwg9VTYYfhuz15Yf1IzCKgZj6/rIbYTmJCUSqr76r0Wg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.57.1", - "@typescript-eslint/type-utils": "8.57.1", - "@typescript-eslint/utils": "8.57.1", - "@typescript-eslint/visitor-keys": "8.57.1", + "@typescript-eslint/scope-manager": "8.58.0", + "@typescript-eslint/type-utils": "8.58.0", + "@typescript-eslint/utils": "8.58.0", + "@typescript-eslint/visitor-keys": "8.58.0", "ignore": "^7.0.5", "natural-compare": "^1.4.0", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1676,9 +1676,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.57.1", + "@typescript-eslint/parser": "^8.58.0", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { @@ -1692,16 +1692,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.57.1.tgz", - "integrity": "sha512-k4eNDan0EIMTT/dUKc/g+rsJ6wcHYhNPdY19VoX/EOtaAG8DLtKCykhrUnuHPYvinn5jhAPgD2Qw9hXBwrahsw==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.58.0.tgz", + "integrity": "sha512-rLoGZIf9afaRBYsPUMtvkDWykwXwUPL60HebR4JgTI8mxfFe2cQTu3AGitANp4b9B2QlVru6WzjgB2IzJKiCSA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.57.1", - "@typescript-eslint/types": "8.57.1", - "@typescript-eslint/typescript-estree": "8.57.1", - "@typescript-eslint/visitor-keys": "8.57.1", + "@typescript-eslint/scope-manager": "8.58.0", + "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/typescript-estree": "8.58.0", + "@typescript-eslint/visitor-keys": "8.58.0", "debug": "^4.4.3" }, "engines": { @@ -1713,18 +1713,18 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.57.1.tgz", - "integrity": "sha512-vx1F37BRO1OftsYlmG9xay1TqnjNVlqALymwWVuYTdo18XuKxtBpCj1QlzNIEHlvlB27osvXFWptYiEWsVdYsg==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.58.0.tgz", + "integrity": "sha512-8Q/wBPWLQP1j16NxoPNIKpDZFMaxl7yWIoqXWYeWO+Bbd2mjgvoF0dxP2jKZg5+x49rgKdf7Ck473M8PC3V9lg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.57.1", - "@typescript-eslint/types": "^8.57.1", + "@typescript-eslint/tsconfig-utils": "^8.58.0", + "@typescript-eslint/types": "^8.58.0", "debug": "^4.4.3" }, "engines": { @@ -1735,18 +1735,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.57.1.tgz", - "integrity": "sha512-hs/QcpCwlwT2L5S+3fT6gp0PabyGk4Q0Rv2doJXA0435/OpnSR3VRgvrp8Xdoc3UAYSg9cyUjTeFXZEPg/3OKg==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.58.0.tgz", + "integrity": "sha512-W1Lur1oF50FxSnNdGp3Vs6P+yBRSmZiw4IIjEeYxd8UQJwhUF0gDgDD/W/Tgmh73mxgEU3qX0Bzdl/NGuSPEpQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.57.1", - "@typescript-eslint/visitor-keys": "8.57.1" + "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/visitor-keys": "8.58.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1757,9 +1757,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.57.1.tgz", - "integrity": "sha512-0lgOZB8cl19fHO4eI46YUx2EceQqhgkPSuCGLlGi79L2jwYY1cxeYc1Nae8Aw1xjgW3PKVDLlr3YJ6Bxx8HkWg==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.58.0.tgz", + "integrity": "sha512-doNSZEVJsWEu4htiVC+PR6NpM+pa+a4ClH9INRWOWCUzMst/VA9c4gXq92F8GUD1rwhNvRLkgjfYtFXegXQF7A==", "dev": true, "license": "MIT", "engines": { @@ -1770,21 +1770,21 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.57.1.tgz", - "integrity": "sha512-+Bwwm0ScukFdyoJsh2u6pp4S9ktegF98pYUU0hkphOOqdMB+1sNQhIz8y5E9+4pOioZijrkfNO/HUJVAFFfPKA==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.58.0.tgz", + "integrity": "sha512-aGsCQImkDIqMyx1u4PrVlbi/krmDsQUs4zAcCV6M7yPcPev+RqVlndsJy9kJ8TLihW9TZ0kbDAzctpLn5o+lOg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.57.1", - "@typescript-eslint/typescript-estree": "8.57.1", - "@typescript-eslint/utils": "8.57.1", + "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/typescript-estree": "8.58.0", + "@typescript-eslint/utils": "8.58.0", "debug": "^4.4.3", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1795,13 +1795,13 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.57.1.tgz", - "integrity": "sha512-S29BOBPJSFUiblEl6RzPPjJt6w25A6XsBqRVDt53tA/tlL8q7ceQNZHTjPeONt/3S7KRI4quk+yP9jK2WjBiPQ==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.58.0.tgz", + "integrity": "sha512-O9CjxypDT89fbHxRfETNoAnHj/i6IpRK0CvbVN3qibxlLdo5p5hcLmUuCCrHMpxiWSwKyI8mCP7qRNYuOJ0Uww==", "dev": true, "license": "MIT", "engines": { @@ -1813,21 +1813,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.57.1.tgz", - "integrity": "sha512-ybe2hS9G6pXpqGtPli9Gx9quNV0TWLOmh58ADlmZe9DguLq0tiAKVjirSbtM1szG6+QH6rVXyU6GTLQbWnMY+g==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.58.0.tgz", + "integrity": "sha512-7vv5UWbHqew/dvs+D3e1RvLv1v2eeZ9txRHPnEEBUgSNLx5ghdzjHa0sgLWYVKssH+lYmV0JaWdoubo0ncGYLA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.57.1", - "@typescript-eslint/tsconfig-utils": "8.57.1", - "@typescript-eslint/types": "8.57.1", - "@typescript-eslint/visitor-keys": "8.57.1", + "@typescript-eslint/project-service": "8.58.0", + "@typescript-eslint/tsconfig-utils": "8.58.0", + "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/visitor-keys": "8.58.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.4.0" + "ts-api-utils": "^2.5.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1837,20 +1837,20 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/utils": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.57.1.tgz", - "integrity": "sha512-XUNSJ/lEVFttPMMoDVA2r2bwrl8/oPx8cURtczkSEswY5T3AeLmCy+EKWQNdL4u0MmAHOjcWrqJp2cdvgjn8dQ==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.58.0.tgz", + "integrity": "sha512-RfeSqcFeHMHlAWzt4TBjWOAtoW9lnsAGiP3GbaX9uVgTYYrMbVnGONEfUCiSss+xMHFl+eHZiipmA8WkQ7FuNA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.57.1", - "@typescript-eslint/types": "8.57.1", - "@typescript-eslint/typescript-estree": "8.57.1" + "@typescript-eslint/scope-manager": "8.58.0", + "@typescript-eslint/types": "8.58.0", + "@typescript-eslint/typescript-estree": "8.58.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1861,17 +1861,17 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.57.1.tgz", - "integrity": "sha512-YWnmJkXbofiz9KbnbbwuA2rpGkFPLbAIetcCNO6mJ8gdhdZ/v7WDXsoGFAJuM6ikUFKTlSQnjWnVO4ux+UzS6A==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.58.0.tgz", + "integrity": "sha512-XJ9UD9+bbDo4a4epraTwG3TsNPeiB9aShrUneAVXy8q4LuwowN+qu89/6ByLMINqvIMeI9H9hOHQtg/ijrYXzQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.57.1", + "@typescript-eslint/types": "8.58.0", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -3202,9 +3202,9 @@ } }, "node_modules/bare-stream": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.10.0.tgz", - "integrity": "sha512-DOPZF/DDcDruKDA43cOw6e9Quq5daua7ygcAwJE/pKJsRWhgSSemi7qVNGE5kyDIxIeN1533G/zfbvWX7Wcb9w==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.11.0.tgz", + "integrity": "sha512-Y/+iQ49fL3rIn6w/AVxI/2+BRrpmzJvdWt5Jv8Za6Ngqc6V227c+pYjYYgLdpR3MwQ9ObVXD0ZrqoBztakM0rw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -3212,10 +3212,14 @@ "teex": "^1.0.1" }, "peerDependencies": { + "bare-abort-controller": "*", "bare-buffer": "*", "bare-events": "*" }, "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + }, "bare-buffer": { "optional": true }, @@ -3256,9 +3260,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.10.10", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.10.tgz", - "integrity": "sha512-sUoJ3IMxx4AyRqO4MLeHlnGDkyXRoUG0/AI9fjK+vS72ekpV0yWVY7O0BVjmBcRtkNcsAO2QDZ4tdKKGoI6YaQ==", + "version": "2.10.11", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.11.tgz", + "integrity": "sha512-DAKrHphkJyiGuau/cFieRYhcTFeK/lBuD++C7cZ6KZHbMhBrisoi+EvhQ5RZrIfV5qwsW8kgQ07JIC+MDJRAhg==", "dev": true, "license": "Apache-2.0", "peer": true, @@ -3401,9 +3405,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz", - "integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==", + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", + "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", "dev": true, "license": "MIT", "dependencies": { @@ -4608,9 +4612,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.321", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.321.tgz", - "integrity": "sha512-L2C7Q279W2D/J4PLZLk7sebOILDSWos7bMsMNN06rK482umHUrh/3lM8G7IlHFOYip2oAg5nha1rCMxr/rs6ZQ==", + "version": "1.5.326", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.326.tgz", + "integrity": "sha512-uRBlUfKKdsXMkiiOurgaybNC10tjrD+skXLEg7NHbm6h0uAoqj3xMb9uue5BfcSCXJ4mcyJMOucI6q55D7p6KQ==", "dev": true, "license": "ISC", "peer": true @@ -4921,9 +4925,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "62.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.8.0.tgz", - "integrity": "sha512-hu3r9/6JBmPG6wTcqtYzgZAnjEG2eqRUATfkFscokESg1VDxZM21ZaMire0KjeMwfj+SXvgB4Rvh5LBuesj92w==", + "version": "62.8.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-62.8.1.tgz", + "integrity": "sha512-e9358PdHgvcMF98foNd3L7hVCw70Lt+YcSL7JzlJebB8eT5oRJtW6bHMQKoAwJtw6q0q0w/fRIr2kwnHdFDI6A==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -10081,9 +10085,9 @@ } }, "node_modules/tapable": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", - "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.2.tgz", + "integrity": "sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA==", "dev": true, "license": "MIT", "peer": true, @@ -10096,9 +10100,9 @@ } }, "node_modules/tar": { - "version": "7.5.12", - "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.12.tgz", - "integrity": "sha512-9TsuLcdhOn4XztcQqhNyq1KOwOOED/3k58JAvtULiYqbO8B/0IBAAIE1hj0Svmm58k27TmcigyDI0deMlgG3uw==", + "version": "7.5.13", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.13.tgz", + "integrity": "sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { @@ -10417,9 +10421,9 @@ "license": "MIT" }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz", + "integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -10431,16 +10435,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.57.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.57.1.tgz", - "integrity": "sha512-fLvZWf+cAGw3tqMCYzGIU6yR8K+Y9NT2z23RwOjlNFF2HwSB3KhdEFI5lSBv8tNmFkkBShSjsCjzx1vahZfISA==", + "version": "8.58.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.58.0.tgz", + "integrity": "sha512-e2TQzKfaI85fO+F3QywtX+tCTsu/D3WW5LVU6nz8hTFKFZ8yBJ6mSYRpXqdR3mFjPWmO0eWsTa5f+UpAOe/FMA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.57.1", - "@typescript-eslint/parser": "8.57.1", - "@typescript-eslint/typescript-estree": "8.57.1", - "@typescript-eslint/utils": "8.57.1" + "@typescript-eslint/eslint-plugin": "8.58.0", + "@typescript-eslint/parser": "8.58.0", + "@typescript-eslint/typescript-estree": "8.58.0", + "@typescript-eslint/utils": "8.58.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -10451,7 +10455,7 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" + "typescript": ">=4.8.4 <6.1.0" } }, "node_modules/uc.micro": { @@ -10462,9 +10466,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.24.5.tgz", - "integrity": "sha512-3IWdCpjgxp15CbJnsi/Y9TCDE7HWVN19j1hmzVhoAkY/+CJx449tVxT5wZc1Gwg8J+P0LWvzlBzxYRnHJ+1i7Q==", + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.24.6.tgz", + "integrity": "sha512-Xi4agocCbRzt0yYMZGMA6ApD7gvtUFaxm4ZmeacWI4cZxaF6C+8I8QfofC20NAePiB/IcvZmzkJ7XPa471AEtA==", "dev": true, "license": "MIT", "engines": { @@ -10472,9 +10476,9 @@ } }, "node_modules/undici-types": { - "version": "7.24.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.5.tgz", - "integrity": "sha512-kNh333UBSbgK35OIW7FwJTr9tTfVIG51Fm1tSVT7m8foPHfDVjsb7OIee/q/rs3bB2aV/3qOPgG5mHNWl1odiA==", + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index 184507104b8..151f6e18d3b 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "puppeteer": "24.40.0", "stylelint": "17.5.0", "stylelint-config-standard": "40.0.0", - "typescript": "5.9.3", - "typescript-eslint": "8.57.1", + "typescript": "6.0.2", + "typescript-eslint": "8.58.0", "undici-types": "^7.24.5", "web-ext": "10.0.0", "webpack-cli": "^7.0.2" diff --git a/tooling/resolve-modules.ts b/tooling/resolve-modules.ts index 765ac1141ad..20d0540b77c 100644 --- a/tooling/resolve-modules.ts +++ b/tooling/resolve-modules.ts @@ -24,7 +24,7 @@ export interface TSConfig { const { compilerOptions } = JSON.parse(readFileSync(tsconfigPath || './tsconfig.json').toString()) as TSConfig; const moduleMap: { [name: string]: string | null } = {}; for (const moduleName of Object.keys(compilerOptions.paths)) { - if (compilerOptions.paths[moduleName].includes('COMMENT')) { + if (compilerOptions.paths[moduleName].some((x: string) => x.endsWith('/COMMENT'))) { // COMMENT flag, remove such import statements from the code, because they will be imported with script tags for compatibility moduleMap[moduleName] = null; // eslint-disable-line no-null/no-null } else { diff --git a/tooling/tsc-compiler.ts b/tooling/tsc-compiler.ts index e705551faa8..3b841cc3a52 100644 --- a/tooling/tsc-compiler.ts +++ b/tooling/tsc-compiler.ts @@ -5,9 +5,6 @@ import * as path from 'path'; import * as ts from 'typescript'; -import { readFileSync } from 'fs'; -import { TSConfig } from './resolve-modules'; - let tsconfigAbsPath: string | undefined; for (let i = 0; i < process.argv.length; i++) { if (process.argv[i] === '-p' || process.argv[i] === '--project') { @@ -99,24 +96,19 @@ const printErrsAndExitIfPresent = (allDiagnostics: ts.Diagnostic[]) => { * Compile using the transformer above */ const compile = (): void => { - const { compilerOptions, include, exclude, files } = JSON.parse(readFileSync(tsconfigAbsPath).toString()) as TSConfig; - const { options, errors } = ts.convertCompilerOptionsFromJson(compilerOptions, tsconfigAbsDir); // , tsconfigAbsPath! - printErrsAndExitIfPresent(errors); - const compilerHost = ts.createCompilerHost(options); - const extensions = ['.ts', '.tsx', '.d.ts']; - if (options.allowJs) { - extensions.push('.js'); + const configFile = ts.readConfigFile(tsconfigAbsPath, path => ts.sys.readFile(path)); + if (configFile.error) { + printErrsAndExitIfPresent([configFile.error]); } - const fileList = files?.length ? files : compilerHost.readDirectory!(tsconfigAbsDir, extensions, exclude, include); // eslint-disable-line @typescript-eslint/no-non-null-assertion + const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, tsconfigAbsDir); + printErrsAndExitIfPresent(parsedConfig.errors.filter(e => e.category === ts.DiagnosticCategory.Error)); + const compilerHost = ts.createCompilerHost(parsedConfig.options); + const fileList = parsedConfig.fileNames; if (!fileList.length) { - console.error( - `fileList empty for ${tsconfigAbsPath}\ninclude:\n${(include || []).join('\n')}\n\nexclude:\n${(exclude || []).join('\n')}\nfiles:\n${(files || []).join( - '\n' - )}` - ); + console.error(`fileList empty for ${tsconfigAbsPath}`); process.exit(1); } - const program = ts.createProgram(fileList, options, compilerHost); + const program = ts.createProgram(fileList, parsedConfig.options, compilerHost); const emitResult = program.emit(undefined, undefined, undefined, undefined, { before: [preserveAsyncStackTracesTransformerFactory()], }); diff --git a/tsconfig.json b/tsconfig.json index 016ddf91f1d..342552dac31 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,25 +12,24 @@ "strict": true, "useUnknownInCatchVariables": false, "outDir": "build/generic-extension-wip", - "baseUrl": "./extension", "moduleResolution": "bundler", "skipLibCheck": true, "paths": { - "jquery": ["lib/jquery.min.js", "COMMENT"], - "sweetalert2": ["lib/sweetalert2.js", "COMMENT"], - "openpgp": ["lib/openpgp.min.mjs", "../node_modules/openpgp/openpgp.d.js"], - "pdfjs": ["lib/pdf.min.mjs", "types/pdf.js.d.ts"], - "squire-rte": ["../node_modules/squire-rte/dist/types/Squire.d.ts"], - "@openpgp/web-stream-tools": ["../node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts", "lib/streams/streams.js"], - "dompurify": ["../node_modules/dompurify/dist/purify.cjs.d.ts", "lib/purify.js", "COMMENT"], - "fine-uploader": ["lib/fine-uploader.js", "COMMENT"], - "filesize": ["lib/filesize.js", "../node_modules/filesize/types/filesize.d.ts"], - "emailjs-mime-parser": ["lib/emailjs/emailjs-mime-parser.js", "COMMENT"], - "emailjs-mime-builder": ["lib/emailjs/emailjs-mime-builder.js", "COMMENT"], - "node-forge": ["./extension/types/node-forge.d.ts", "lib/forge.mjs"], - "undici-types": ["../node_modules/undici-types/index.d.ts", "COMMENT"], - "linkifyHtml": ["../node_modules/linkify-html/dist/linkify-html.d.cts", "COMMENT"], - "linkifyjs": ["../node_modules/linkifyjs/dist/linkify.d.cts", "COMMENT"] + "jquery": ["./extension/lib/jquery.min.js", "./COMMENT"], + "sweetalert2": ["./extension/lib/sweetalert2.js", "./COMMENT"], + "openpgp": ["./extension/lib/openpgp.min.mjs", "./node_modules/openpgp/openpgp.d.js"], + "pdfjs": ["./extension/lib/pdf.min.mjs", "./extension/types/pdf.js.d.ts"], + "squire-rte": ["./node_modules/squire-rte/dist/types/Squire.d.ts"], + "@openpgp/web-stream-tools": ["./node_modules/@openpgp/web-stream-tools/lib/types/index.d.ts", "./extension/lib/streams/streams.js"], + "dompurify": ["./node_modules/dompurify/dist/purify.cjs.d.ts", "./extension/lib/purify.js", "./COMMENT"], + "fine-uploader": ["./extension/lib/fine-uploader.js", "./COMMENT"], + "filesize": ["./extension/lib/filesize.js", "./node_modules/filesize/types/filesize.d.ts"], + "emailjs-mime-parser": ["./extension/lib/emailjs/emailjs-mime-parser.js", "./COMMENT"], + "emailjs-mime-builder": ["./extension/lib/emailjs/emailjs-mime-builder.js", "./COMMENT"], + "node-forge": ["./extension/types/node-forge.d.ts", "./extension/lib/forge.mjs"], + "undici-types": ["./node_modules/undici-types/index.d.ts", "./COMMENT"], + "linkifyHtml": ["./node_modules/linkify-html/dist/linkify-html.d.cts", "./COMMENT"], + "linkifyjs": ["./node_modules/linkifyjs/dist/linkify.d.cts", "./COMMENT"] }, "typeRoots": ["./extension/js/common/core/types", "./extension/types"] }, From dbaba902c63ff99315d87b4a91830177153eba39 Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Wed, 1 Apr 2026 01:20:06 -0300 Subject: [PATCH 2/6] fix: add strict type --- conf/tsconfig.test.json | 2 -- test/source/browser/controllable.ts | 6 +++--- test/source/test.ts | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/conf/tsconfig.test.json b/conf/tsconfig.test.json index aa4800080f8..5dfdeabb0b7 100644 --- a/conf/tsconfig.test.json +++ b/conf/tsconfig.test.json @@ -5,9 +5,7 @@ "alwaysStrict": true, "noImplicitAny": true, "strictNullChecks": true, - "strictPropertyInitialization": false, "strictFunctionTypes": false, - "useUnknownInCatchVariables": false, "allowSyntheticDefaultImports": true, "esModuleInterop": true, "module": "commonjs", diff --git a/test/source/browser/controllable.ts b/test/source/browser/controllable.ts index 27121a7c97f..ab0c359a2e5 100644 --- a/test/source/browser/controllable.ts +++ b/test/source/browser/controllable.ts @@ -100,7 +100,7 @@ abstract class ControllableBase { await this.waitAny(selectors, { timeout: 0 }); // if this fails, that means there are none left: return success await Util.sleep(1); } catch (e) { - if (e.message.indexOf('waiting failed') === 0) { + if (e instanceof Error && e.message.indexOf('waiting failed') === 0) { return; } } @@ -743,7 +743,7 @@ class ConsoleEvent { } export class ControllablePage extends ControllableBase { - public target: Page; + public declare target: Page; public consoleMsgs: (ConsoleMessage | ConsoleEvent)[] = []; public alerts: ControllableAlert[] = []; private preventclose = false; @@ -940,7 +940,7 @@ export class ControllablePage extends ControllableBase { } export class ControllableFrame extends ControllableBase { - public target: Frame; + public declare target: Frame; public frame: Frame; public constructor( diff --git a/test/source/test.ts b/test/source/test.ts index a389ed7356d..64af77c31d7 100644 --- a/test/source/test.ts +++ b/test/source/test.ts @@ -1,6 +1,6 @@ /* ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com */ -import test, { Implementation } from 'ava'; +import test from 'ava'; import { exec } from 'child_process'; import { promisify } from 'util'; @@ -59,7 +59,7 @@ const testWithBrowser = ( cb: (t: AvaContext, browser: BrowserHandle) => Promise, flag?: 'FAILING', timeout = consts.TIMEOUT_EACH_RETRY -): Implementation => { +) => { return async (t: AvaContext) => { const mockApi = isMock ? await startMockApiAndCopyBuild(t) : undefined; if (isMock) { From ca81961f19fdc6503ceb27a7a33cfb5810db6bbb Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Wed, 1 Apr 2026 02:02:50 -0300 Subject: [PATCH 3/6] fix: test --- test/source/browser/controllable.ts | 2 +- tooling/resolve-modules.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/source/browser/controllable.ts b/test/source/browser/controllable.ts index ab0c359a2e5..e76003f85c9 100644 --- a/test/source/browser/controllable.ts +++ b/test/source/browser/controllable.ts @@ -100,7 +100,7 @@ abstract class ControllableBase { await this.waitAny(selectors, { timeout: 0 }); // if this fails, that means there are none left: return success await Util.sleep(1); } catch (e) { - if (e instanceof Error && e.message.indexOf('waiting failed') === 0) { + if (e instanceof Error && e.message.startsWith('waiting failed')) { return; } } diff --git a/tooling/resolve-modules.ts b/tooling/resolve-modules.ts index 20d0540b77c..e4722655bdb 100644 --- a/tooling/resolve-modules.ts +++ b/tooling/resolve-modules.ts @@ -29,7 +29,8 @@ for (const moduleName of Object.keys(compilerOptions.paths)) { moduleMap[moduleName] = null; // eslint-disable-line no-null/no-null } else { // replace import with full path from config - moduleMap[moduleName] = `${compilerOptions.paths[moduleName].find((x: string) => /\.(mjs|js)$/.exec(x) !== null)}`; // eslint-disable-line no-null/no-null + const selectedPath = compilerOptions.paths[moduleName].find((x: string) => /\.(mjs|js)$/.exec(x) !== null); + moduleMap[moduleName] = selectedPath?.replace(/^\.\/extension\//, '') || null; // eslint-disable-line no-null/no-null } } From aefed07db59cf3fa727d09c8e5fab82f98bb5c2e Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Wed, 1 Apr 2026 02:08:56 -0300 Subject: [PATCH 4/6] fix: test --- test/source/test.ts | 4 ++-- tooling/resolve-modules.ts | 27 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/test/source/test.ts b/test/source/test.ts index 64af77c31d7..a389ed7356d 100644 --- a/test/source/test.ts +++ b/test/source/test.ts @@ -1,6 +1,6 @@ /* ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com */ -import test from 'ava'; +import test, { Implementation } from 'ava'; import { exec } from 'child_process'; import { promisify } from 'util'; @@ -59,7 +59,7 @@ const testWithBrowser = ( cb: (t: AvaContext, browser: BrowserHandle) => Promise, flag?: 'FAILING', timeout = consts.TIMEOUT_EACH_RETRY -) => { +): Implementation => { return async (t: AvaContext) => { const mockApi = isMock ? await startMockApiAndCopyBuild(t) : undefined; if (isMock) { diff --git a/tooling/resolve-modules.ts b/tooling/resolve-modules.ts index e4722655bdb..06bec861651 100644 --- a/tooling/resolve-modules.ts +++ b/tooling/resolve-modules.ts @@ -22,15 +22,16 @@ export interface TSConfig { } const { compilerOptions } = JSON.parse(readFileSync(tsconfigPath || './tsconfig.json').toString()) as TSConfig; -const moduleMap: { [name: string]: string | null } = {}; +const moduleMap: { [name: string]: string | undefined } = {}; +const commentImportedModules = new Set(); for (const moduleName of Object.keys(compilerOptions.paths)) { if (compilerOptions.paths[moduleName].some((x: string) => x.endsWith('/COMMENT'))) { // COMMENT flag, remove such import statements from the code, because they will be imported with script tags for compatibility - moduleMap[moduleName] = null; // eslint-disable-line no-null/no-null + commentImportedModules.add(moduleName); } else { // replace import with full path from config - const selectedPath = compilerOptions.paths[moduleName].find((x: string) => /\.(mjs|js)$/.exec(x) !== null); - moduleMap[moduleName] = selectedPath?.replace(/^\.\/extension\//, '') || null; // eslint-disable-line no-null/no-null + const selectedPath = compilerOptions.paths[moduleName].find((x: string) => /\.(mjs|js)$/.test(x)); + moduleMap[moduleName] = selectedPath?.replace(/^\.\/extension\//, ''); } } @@ -41,18 +42,18 @@ const importLineEndingWithJsNotStartingWithDot = /^(?!\s*\/\/)(?!\s*\/\*)(?:\s*i const resolveLineImports = (regex: RegExp, line: string, path: string) => line.replace(regex, (found, prefix, libname: string, suffix) => { - // eslint-disable-next-line no-null/no-null - if (moduleMap[libname] === null) { + if (commentImportedModules.has(libname)) { return `// ${prefix}${libname}${suffix} // commented during build process: imported with script tag`; - } else if (!moduleMap[libname]) { + } + const mappedModulePath = moduleMap[libname]; + if (!mappedModulePath) { return found; - } else { - const depth = path.split(sep).length; - const prePath = '../'.repeat(depth - 3); // todo: - const resolved = `${prefix}${prePath}${moduleMap[libname]}${suffix}`; - // console.info(`${path}: ${found} -> ${resolved}`); - return resolved; } + const depth = path.split(sep).length; + const prePath = '../'.repeat(depth - 3); // todo: + const resolved = `${prefix}${prePath}${mappedModulePath}${suffix}`; + // console.info(`${path}: ${found} -> ${resolved}`); + return resolved; }); const errIfSrcMissingJsExtensionInImport = (src: string, path: string) => { From 34b776fae2a3221dc6eddd989bded4594aff2ee2 Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Wed, 1 Apr 2026 09:57:35 -0300 Subject: [PATCH 5/6] fix: test --- test/source/browser/controllable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/source/browser/controllable.ts b/test/source/browser/controllable.ts index e76003f85c9..9b0e68da27a 100644 --- a/test/source/browser/controllable.ts +++ b/test/source/browser/controllable.ts @@ -45,12 +45,12 @@ abstract class ControllableBase { }; public waitForSelTestState = async (state: 'ready' | 'working' | 'waiting' | 'closed', timeout = TIMEOUT_TEST_STATE_SATISFY) => { - await this.waitAll(`[data-test-state="${state}"]`, { timeout, visible: undefined }); + await this.waitAny(`[data-test-state="${state}"]`, { timeout, visible: undefined }); }; public waitUntilViewLoaded = async (timeout = TIMEOUT_PAGE_LOAD) => { try { - await this.waitAll(`[data-test-view-state="loaded"]`, { timeout, visible: undefined }); + await this.waitAny(`[data-test-view-state="loaded"]`, { timeout, visible: undefined }); } catch { throw new Error(`View didn't load within ${timeout}s at ${this.target.url()}`); } From 94934e9ac51de17ec5348e04dbfc792a2a05468d Mon Sep 17 00:00:00 2001 From: Ioan Moldovan Date: Wed, 1 Apr 2026 20:04:34 -0300 Subject: [PATCH 6/6] fix: test --- test/source/browser/controllable.ts | 4 ++-- test/source/tests/decrypt.ts | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/test/source/browser/controllable.ts b/test/source/browser/controllable.ts index 9b0e68da27a..e76003f85c9 100644 --- a/test/source/browser/controllable.ts +++ b/test/source/browser/controllable.ts @@ -45,12 +45,12 @@ abstract class ControllableBase { }; public waitForSelTestState = async (state: 'ready' | 'working' | 'waiting' | 'closed', timeout = TIMEOUT_TEST_STATE_SATISFY) => { - await this.waitAny(`[data-test-state="${state}"]`, { timeout, visible: undefined }); + await this.waitAll(`[data-test-state="${state}"]`, { timeout, visible: undefined }); }; public waitUntilViewLoaded = async (timeout = TIMEOUT_PAGE_LOAD) => { try { - await this.waitAny(`[data-test-view-state="loaded"]`, { timeout, visible: undefined }); + await this.waitAll(`[data-test-view-state="loaded"]`, { timeout, visible: undefined }); } catch { throw new Error(`View didn't load within ${timeout}s at ${this.target.url()}`); } diff --git a/test/source/tests/decrypt.ts b/test/source/tests/decrypt.ts index 4053b42248d..f8fdb1b09f7 100644 --- a/test/source/tests/decrypt.ts +++ b/test/source/tests/decrypt.ts @@ -1627,25 +1627,37 @@ XZ8r4OC6sguP/yozWlkG+7dDxsgKQVBENeG6Lw== test( 'decrypt - public key is rendered minimized for outgoing messages', testWithBrowser(async (t, browser) => { + const assertOutgoingPubkeyFrameIsMinimized = async (page: ControllablePage) => { + for (const attempt of [1, 2, 3]) { + const pubkeyFrame = await page.getFrame(['pgp_pubkey.htm'], { sleep: attempt === 1 ? 1 : 0, timeout: 20 }); + try { + await pubkeyFrame.waitUntilViewLoaded(90); + await pubkeyFrame.waitForContent('@container-pgp-pubkey', 'Public Key', 30); + expect(await pubkeyFrame.isElementVisible('@action-add-contact')).to.be.false; // hidden because sender matches acctEmail + return; + } catch (e) { + if (attempt === 3) { + throw e; + } + t.log(`Retrying minimized pubkey frame assertion (${attempt + 1}/3)`); + await Util.sleep(1); + } + } + }; + const { acctEmail, authHdr } = await BrowserRecipe.setupCommonAcctWithAttester(t, browser, 'ci.tests.gmail'); const threadId = '1869220e0c8f16de'; const inboxPage = await browser.newExtensionInboxPage(t, acctEmail, threadId); await inboxPage.waitAll('iframe'); expect((await inboxPage.getFramesUrls(['pgp_block.htm'])).length).to.equal(1); expect((await inboxPage.getFramesUrls(['attachment.htm'])).length).to.equal(0); // invisible - const pubkeyFrame1 = await inboxPage.getFrame(['pgp_pubkey.htm']); - await pubkeyFrame1.waitUntilViewLoaded(); - await pubkeyFrame1.waitForContent('@container-pgp-pubkey', 'Public Key'); - expect(await pubkeyFrame1.isElementVisible('@action-add-contact')).to.be.false; // should be hidden because the sender matches acctEmail + await assertOutgoingPubkeyFrameIsMinimized(inboxPage); await inboxPage.close(); const gmailPage = await browser.newPage(t, `${t.context.urls?.mockGmailUrl()}/${threadId}`, undefined, authHdr); await gmailPage.waitAll('iframe'); expect((await gmailPage.getFramesUrls(['pgp_block.htm'])).length).to.equal(1); expect((await gmailPage.getFramesUrls(['attachment.htm'])).length).to.equal(0); // invisible - const pubkeyFrame2 = await gmailPage.getFrame(['pgp_pubkey.htm']); - await pubkeyFrame2.waitUntilViewLoaded(); - await pubkeyFrame2.waitForContent('@container-pgp-pubkey', 'Public Key'); - expect(await pubkeyFrame2.isElementVisible('@action-add-contact')).to.be.false; // should be hidden because the sender matches acctEmail + await assertOutgoingPubkeyFrameIsMinimized(gmailPage); }) );