jest-preset-angular icon indicating copy to clipboard operation
jest-preset-angular copied to clipboard

[Bug]: tslib problem in esm mode - SyntaxError: Unexpected token 'export'

Open osnoser1 opened this issue 1 year ago • 1 comments

Version

13.0.1

Steps to reproduce

I'm trying to use run a test in esm mode and I get an error related to a library aws-amplify and tslib.

If you see the error, it looks like a nested import of tslib in node_modules\@aws-crypto\sha256-js\node_modules\tslib\tslib.es6.js:24

I have this line tslib: 'tslib/tslib.es6.js', in moduleNameMapper object as the documentation says.

I'd appreciate your help and thank you very much in advance.

Expected behavior

Test should run

Actual behavior

image

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.22622
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400 @ 2.60GHz
  Binaries:
    Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.18 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^29.5.0 => 29.5.0

osnoser1 avatar Apr 17 '23 18:04 osnoser1

The config line you added only works with non nested tslib which is directly under node_modules. For your case you need to map the nested one under @aws

ahnpnl avatar Apr 19 '23 10:04 ahnpnl