swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular

Home Page:https://swimlane.github.io/ngx-charts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JEST transformIgnorePatterns not working

robvaneckalliander opened this issue · comments

    "@swimlane/ngx-charts": "^20.5.0",

    "@types/jest": "^29.5.12",
    "@types/node": "^18.18.0",
    "@typescript-eslint/eslint-plugin": "^6.19.0",
    "@typescript-eslint/parser": "^6.19.0",
    "jest": "^29.7.0",
    "jest-canvas-mock": "^2.5.2",
    "jest-environment-jsdom": "^29.7.0",
    "jest-preset-angular": "^14.0.3",

already tried:

jest.config.js

const esModules = ['@swimlane', '@swimlane*', 'd3', 'd3-array', 'd3-selection', 'd3-*'].join('|');

transformIgnorePatterns: [
    `<rootDir>/node_modules/(?!${esModules})`,
  ],

but still

d3-selection\src\index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export {default as create} from "./create.js";
                                                                                      ^^^^^^

    SyntaxError: Unexpected token 'export' 

Hello, same problem here.
Is there any updates on this ?
@robvaneckalliander did you find a way to bypass the problem ?
Thanks in advance.

This line in jest.config.json helps me:
"transformIgnorePatterns": ["node_modules/(?!.*.mjs$|d3)"],