Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore: update to Jest 29 and fix tests
- Update all packages to use Jest 29
- Update root configuration and yarn.lock
- Fix ts-jest configuration for Jest 29
- Fix TypeScript errors in UserOperationController tests
- Update snapshots for Jest 29 format changes
- Increase test timeout to 30s to prevent flakes
  • Loading branch information
cryptodev-2s committed Nov 27, 2025
commit 7ad5f4381f749c5cb3a3e7af8efc8590c1c92773
14 changes: 12 additions & 2 deletions jest.config.packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,17 @@ module.exports = {
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',
preset: 'ts-jest/presets/default',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [151002],
},
},
],
},

// The path to the Prettier executable used to format snapshots
// Jest doesn't support Prettier 3 yet, so we use Prettier 2
Expand Down Expand Up @@ -184,7 +194,7 @@ module.exports = {
// testRunner: "jest-circus/runner",

// Default timeout of a test in milliseconds.
// testTimeout: 5000,
testTimeout: 30000,

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@metamask/network-controller": "^25.0.0",
"@metamask/utils": "^11.8.1",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"@types/lodash": "^4.14.191",
"@types/node": "^16.18.54",
"@types/semver": "^7",
Expand All @@ -80,14 +80,14 @@
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import-x": "^4.3.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jest": "^29.2.0",
"eslint-plugin-jsdoc": "^50.2.4",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^7.1.0",
"execa": "^5.0.0",
"isomorphic-fetch": "^3.0.0",
"jest": "^28.0.0",
"jest": "^29.5.0",
"jest-environment-node": "^29.0.0",
"jest-silent-reporter": "^0.5.0",
"lodash": "^4.17.21",
Expand Down
6 changes: 3 additions & 3 deletions packages/account-tree-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
"@metamask/providers": "^22.1.0",
"@metamask/snaps-controllers": "^14.0.1",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"deepmerge": "^4.2.2",
"jest": "^28.0.0",
"ts-jest": "^28.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4276,7 +4276,7 @@ describe('AccountTreeController', () => {
controller.metadata,
'includeInDebugSnapshot',
),
).toMatchInlineSnapshot(`Object {}`);
).toMatchInlineSnapshot(`{}`);
});

it('includes expected state in state logs', () => {
Expand All @@ -4289,13 +4289,13 @@ describe('AccountTreeController', () => {
'includeInStateLogs',
),
).toMatchInlineSnapshot(`
Object {
"accountGroupsMetadata": Object {},
"accountTree": Object {
{
"accountGroupsMetadata": {},
"accountTree": {
"selectedAccountGroup": "",
"wallets": Object {},
"wallets": {},
},
"accountWalletsMetadata": Object {},
"accountWalletsMetadata": {},
"hasAccountTreeSyncingSyncedAtLeastOnce": false,
}
`);
Expand All @@ -4311,9 +4311,9 @@ describe('AccountTreeController', () => {
'persist',
),
).toMatchInlineSnapshot(`
Object {
"accountGroupsMetadata": Object {},
"accountWalletsMetadata": Object {},
{
"accountGroupsMetadata": {},
"accountWalletsMetadata": {},
"hasAccountTreeSyncingSyncedAtLeastOnce": false,
}
`);
Expand All @@ -4329,13 +4329,13 @@ describe('AccountTreeController', () => {
'usedInUi',
),
).toMatchInlineSnapshot(`
Object {
"accountGroupsMetadata": Object {},
"accountTree": Object {
{
"accountGroupsMetadata": {},
"accountTree": {
"selectedAccountGroup": "",
"wallets": Object {},
"wallets": {},
},
"accountWalletsMetadata": Object {},
"accountWalletsMetadata": {},
"hasAccountTreeSyncingSyncedAtLeastOnce": false,
"isAccountTreeSyncingInProgress": false,
}
Expand Down
6 changes: 3 additions & 3 deletions packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
"@metamask/providers": "^22.1.0",
"@metamask/snaps-controllers": "^14.0.1",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"@types/readable-stream": "^2.3.0",
"jest": "^28.0.0",
"ts-jest": "^28.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3",
Expand Down
20 changes: 10 additions & 10 deletions packages/accounts-controller/src/AccountsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@ describe('AccountsController', () => {
controller.metadata,
'includeInDebugSnapshot',
),
).toMatchInlineSnapshot(`Object {}`);
).toMatchInlineSnapshot(`{}`);
});

it('includes expected state in state logs', () => {
Expand All @@ -3967,9 +3967,9 @@ describe('AccountsController', () => {
'includeInStateLogs',
),
).toMatchInlineSnapshot(`
Object {
"internalAccounts": Object {
"accounts": Object {},
{
"internalAccounts": {
"accounts": {},
"selectedAccount": "",
},
}
Expand All @@ -3986,9 +3986,9 @@ describe('AccountsController', () => {
'persist',
),
).toMatchInlineSnapshot(`
Object {
"internalAccounts": Object {
"accounts": Object {},
{
"internalAccounts": {
"accounts": {},
"selectedAccount": "",
},
}
Expand All @@ -4005,9 +4005,9 @@ describe('AccountsController', () => {
'usedInUi',
),
).toMatchInlineSnapshot(`
Object {
"internalAccounts": Object {
"accounts": Object {},
{
"internalAccounts": {
"accounts": {},
"selectedAccount": "",
},
}
Expand Down
6 changes: 3 additions & 3 deletions packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"deepmerge": "^4.2.2",
"jest": "^28.0.0",
"ts-jest": "^28.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ describe('AddressBookController', () => {
controller.metadata,
'includeInDebugSnapshot',
),
).toMatchInlineSnapshot(`Object {}`);
).toMatchInlineSnapshot(`{}`);
});

it('includes expected state in state logs', () => {
Expand All @@ -663,8 +663,8 @@ describe('AddressBookController', () => {
'includeInStateLogs',
),
).toMatchInlineSnapshot(`
Object {
"addressBook": Object {},
{
"addressBook": {},
}
`);
});
Expand All @@ -679,8 +679,8 @@ describe('AddressBookController', () => {
'persist',
),
).toMatchInlineSnapshot(`
Object {
"addressBook": Object {},
{
"addressBook": {},
}
`);
});
Expand All @@ -695,8 +695,8 @@ describe('AddressBookController', () => {
'usedInUi',
),
).toMatchInlineSnapshot(`
Object {
"addressBook": Object {},
{
"addressBook": {},
}
`);
});
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"deepmerge": "^4.2.2",
"jest": "^28.0.0",
"ts-jest": "^28.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3"
Expand Down
6 changes: 3 additions & 3 deletions packages/announcement-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"deepmerge": "^4.2.2",
"jest": "^28.0.0",
"ts-jest": "^28.0.0",
"jest": "^29.5.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ describe('announcement controller', () => {
'includeInDebugSnapshot',
),
).toMatchInlineSnapshot(`
Object {
"announcements": Object {
"1": Object {
{
"announcements": {
"1": {
"date": "12/8/2020",
"id": 1,
"isShown": false,
},
"2": Object {
"2": {
"date": "12/8/2020",
"id": 2,
"isShown": false,
Expand All @@ -219,14 +219,14 @@ describe('announcement controller', () => {
'includeInStateLogs',
),
).toMatchInlineSnapshot(`
Object {
"announcements": Object {
"1": Object {
{
"announcements": {
"1": {
"date": "12/8/2020",
"id": 1,
"isShown": false,
},
"2": Object {
"2": {
"date": "12/8/2020",
"id": 2,
"isShown": false,
Expand All @@ -249,14 +249,14 @@ describe('announcement controller', () => {
'persist',
),
).toMatchInlineSnapshot(`
Object {
"announcements": Object {
"1": Object {
{
"announcements": {
"1": {
"date": "12/8/2020",
"id": 1,
"isShown": false,
},
"2": Object {
"2": {
"date": "12/8/2020",
"id": 2,
"isShown": false,
Expand All @@ -279,14 +279,14 @@ describe('announcement controller', () => {
'usedInUi',
),
).toMatchInlineSnapshot(`
Object {
"announcements": Object {
"1": Object {
{
"announcements": {
"1": {
"date": "12/8/2020",
"id": 1,
"isShown": false,
},
"2": Object {
"2": {
"date": "12/8/2020",
"id": 2,
"isShown": false,
Expand Down
6 changes: 3 additions & 3 deletions packages/app-metadata-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@ts-bridge/cli": "^0.6.4",
"@types/jest": "^28.0.0",
"@types/jest": "^29.5.0",
"deepmerge": "^4.2.2",
"jest": "^28.0.0",
"jest": "^29.5.0",
"sinon": "^9.2.4",
"ts-jest": "^28.0.0",
"ts-jest": "^29.4.0",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3"
Expand Down
Loading
Loading