kulshekhar / ts-jest

A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.

Home Page:https://kulshekhar.github.io/ts-jest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Error while importing a default export from a dependency

betabandido opened this issue · comments

Version

29.0.3

Steps to reproduce

I created two replits:

  1. https://replit.com/@betabandido/ts-jest-issue-1
  2. https://replit.com/@betabandido/ts-jest-issue-2

Both contain two packages: child and parent. The child package imports the default export from use-deep-compare-effect (https://github.com/kentcdodds/use-deep-compare-effect). The only difference between both replits is that the first one imports the default export from the mentioned package, while the second one imports a named export.

For each replit, the instructions to reproduce the error (and the lack of in the second case) are to execute these commands:

pnpm lerna run build
pnpm lerna run test

Expected behavior

I would expect tests to succeed no matter whether I import named or default exports from my dependencies.

Actual behavior

The same test fail when the child package imports the default export from use-deep-compare-effect, and they succeed when the child package imports a named export from that same package.

Debug log

ts-jest.log

Additional context

The issue also happens when developing locally. I just used a replit for simplicity.

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (8) x64 AMD EPYC 7B12
  Binaries:
    Node: 16.13.2 - /nix/store/ra8r42571xvv1m85wanh1ll9mxmp0mwl-nodejs-16.13.2/bin/node
    npm: 8.1.2 - /nix/store/ra8r42571xvv1m85wanh1ll9mxmp0mwl-nodejs-16.13.2/bin/npm