Skip to content

Commit

Permalink
fix(TDP-12694): broken applyBabelTransformOn after pnpm use-case
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigui committed Nov 23, 2023
1 parent 8fe98bc commit c60f8b9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-peas-dress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/scripts-config-jest': patch
---

fix(TDP-12694): broken applyBabelTransformOn after pnpm use-case
15 changes: 15 additions & 0 deletions tools/scripts-config-jest/__tests__/utils.test.js
Original file line number Diff line number Diff line change
@@ -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))',
);
});
});
});
4 changes: 2 additions & 2 deletions tools/scripts-config-jest/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function applyBabelTransformOn(config, pkgs) {
config.transformIgnorePatterns[0] = config.transformIgnorePatterns[0].replace(
')',
`|${pkgs.join('|')})`,
/(\)\)$)/,
`|${pkgs.join('|')}$1`,
);
}

Expand Down

0 comments on commit c60f8b9

Please sign in to comment.