From 6a75b6cafb9e3adfd5b575f3a09cd74ff3352b4d Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Mon, 26 Jun 2023 09:53:37 +0100 Subject: [PATCH] Babel transform only `*.mjs` files for Jest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don’t need to transform `*.js` files as they’re typically supported by Jest already, but we’ll add another commit to handle some exceptions --- jest.config.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jest.config.mjs b/jest.config.mjs index f91f489a2b..fd16677d0c 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -32,10 +32,10 @@ const config = { */ testEnvironment: 'jest-environment-node-single-context', - // Enable Babel transforms until Jest supports ESM + // Enable Babel transforms until Jest supports ESM and `import()` // See: https://jestjs.io/docs/ecmascript-modules transform: { - '^.+\\.m?js$': ['babel-jest', { rootMode: 'upward' }] + '^.+\\.mjs$': ['babel-jest', { rootMode: 'upward' }] }, // Enable Babel transforms for ESM-only node_modules