swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.29k stars 1.15k forks source link

JEST transformIgnorePatterns not working #1947

Open robvaneckalliander opened 6 months ago

robvaneckalliander commented 6 months ago
    "@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' 
erwanbecquetdedalus commented 5 months ago

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

dananaprey commented 3 months ago

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