Skip to content

Commit 1e0e162

Browse files
committed
ODC-6675: [HACK] Downgrade @types/jest
The newer versions of `@types/jest` check the shape of mocked functions and objects with their actual counterparts. A large number of our tests unfortunately have mocks that don't have all the properties of their real counterparts, causing many type errors. To reduce the risk from large code changes in this PR (especially since we are so late into the 4.19 development cycle), I am going to downgrade `@types/jest` until there is time to reconcile these type errors.
1 parent 5b83cb5 commit 1e0e162

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

frontend/@types/console/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference path="./react.d.ts" />
2+
/// <reference path="./jest.d.ts" />
23
/// <reference path="./generated/graphql-queries.d.ts" />
34

45
declare module '*.svg' {

frontend/@types/console/jest.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import 'jest';
2+
3+
declare global {
4+
namespace jest {
5+
/**
6+
* Returns the actual module instead of a mock, bypassing all checks on
7+
* whether the module should receive a mock implementation or not.
8+
*
9+
* TODO: Update `@types/jest` and reconcile the type errors, then remove this file.
10+
*/
11+
function requireActual(moduleName: string): any;
12+
}
13+
}

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"@types/glob": "7.x",
237237
"@types/immutable": "3.x",
238238
"@types/jasmine": "2.8.x",
239-
"@types/jest": "^29.5.14",
239+
"@types/jest": "^22.x",
240240
"@types/json-schema": "^7.0.7",
241241
"@types/lodash-es": "4.17.x",
242242
"@types/node": "22.x",

frontend/yarn.lock

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2933,13 +2933,10 @@
29332933
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.16.tgz#a6cb24b1149d65293bd616923500014838e14e7d"
29342934
integrity sha512-056oRlBBp7MDzr+HoU5su099s/s7wjZ3KcHxLfv+Byqb9MwdLUvsfLgw1VS97hsh3ddxSPyQu+olHMnoVTUY6g==
29352935

2936-
"@types/jest@^29.5.14":
2937-
version "29.5.14"
2938-
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5"
2939-
integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==
2940-
dependencies:
2941-
expect "^29.0.0"
2942-
pretty-format "^29.0.0"
2936+
"@types/jest@^22.x":
2937+
version "22.2.3"
2938+
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-22.2.3.tgz#0157c0316dc3722c43a7b71de3fdf3acbccef10d"
2939+
integrity sha512-e74sM9W/4qqWB6D4TWV9FQk0WoHtX1X4FJpbjxucMSVJHtFjbQOH3H6yp+xno4br0AKG0wz/kPtaN599GUOvAg==
29432940

29442941
29452942
version "0.5.31"
@@ -8389,7 +8386,7 @@ expect@^24.5.0:
83898386
jest-message-util "^24.9.0"
83908387
jest-regex-util "^24.9.0"
83918388

8392-
expect@^29.0.0, expect@^29.7.0:
8389+
expect@^29.7.0:
83938390
version "29.7.0"
83948391
resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc"
83958392
integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==
@@ -14108,7 +14105,7 @@ pretty-format@^27.0.2:
1410814105
ansi-styles "^5.0.0"
1410914106
react-is "^17.0.1"
1411014107

14111-
pretty-format@^29.0.0, pretty-format@^29.7.0:
14108+
pretty-format@^29.7.0:
1411214109
version "29.7.0"
1411314110
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
1411414111
integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==

0 commit comments

Comments
 (0)