From fd4a4f8fd217df20076fc7a1b55f10e246b034cb Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 20 Aug 2025 13:21:45 -0230 Subject: [PATCH] chore: Update Jest config to map `next` export to source correctly Tests that used the `@metamask/base-controller/next` export were not working correctly until after a build was completed. They were using the built code rather than the source code. On CI the tests run without any build, so they would always fail. This was resolved up updating the TSConfig and Jest config to map the `next` export to the correct source code. This unblocks #6335 as well as other controller migrations to the upcoming BaseController version. --- jest.config.packages.js | 3 +++ tsconfig.packages.json | 1 + 2 files changed, 4 insertions(+) diff --git a/jest.config.packages.js b/jest.config.packages.js index ce6f1f267d3..09cdfa9efe5 100644 --- a/jest.config.packages.js +++ b/jest.config.packages.js @@ -80,6 +80,9 @@ module.exports = { // Here we ensure that Jest resolves `@metamask/*` imports to the uncompiled source code for packages that live in this repo. // NOTE: This must be synchronized with the `paths` option in `tsconfig.packages.json`. moduleNameMapper: { + '^@metamask/base-controller/next': [ + '/../base-controller/src/next', + ], '^@metamask/(.+)$': [ '/../$1/src', // Some @metamask/* packages we are referencing aren't in this monorepo, diff --git a/tsconfig.packages.json b/tsconfig.packages.json index 8d0d5aee5ed..327abba7f81 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -13,6 +13,7 @@ * `jest.config.packages.js`. */ "paths": { + "@metamask/base-controller/next": ["../base-controller/src/next"], "@metamask/*": ["../*/src"] }, "strict": true,