diff --git a/.changeset/tidy-peas-dress.md b/.changeset/tidy-peas-dress.md new file mode 100644 index 00000000000..fbccaee3fb8 --- /dev/null +++ b/.changeset/tidy-peas-dress.md @@ -0,0 +1,5 @@ +--- +'@talend/scripts-config-jest': patch +--- + +fix(TDP-12694): broken applyBabelTransformOn after pnpm use-case diff --git a/tools/scripts-config-jest/__tests__/utils.test.js b/tools/scripts-config-jest/__tests__/utils.test.js new file mode 100644 index 00000000000..5c1fcde8cf8 --- /dev/null +++ b/tools/scripts-config-jest/__tests__/utils.test.js @@ -0,0 +1,15 @@ +import { applyBabelTransformOn } from '../utils'; + +describe('utilities', () => { + describe('applyBabelTransformOn', () => { + it('should add babel transform directive', () => { + const config = { + transformIgnorePatterns: ['node_modules/(?!(?:.pnpm/)?(d3|internmap))'], + }; + applyBabelTransformOn(config, ['dexie']); + expect(config.transformIgnorePatterns[0]).toBe( + 'node_modules/(?!(?:.pnpm/)?(d3|internmap|dexie))', + ); + }); + }); +}); diff --git a/tools/scripts-config-jest/utils.js b/tools/scripts-config-jest/utils.js index 2f38fa81802..8e8ecd5a72e 100644 --- a/tools/scripts-config-jest/utils.js +++ b/tools/scripts-config-jest/utils.js @@ -1,7 +1,7 @@ function applyBabelTransformOn(config, pkgs) { config.transformIgnorePatterns[0] = config.transformIgnorePatterns[0].replace( - ')', - `|${pkgs.join('|')})`, + /(\)\)$)/, + `|${pkgs.join('|')}$1`, ); }