jestjs / jest

Delightful JavaScript Testing.
https://jestjs.io
MIT License
44.12k stars 6.44k forks source link

[Bug]: transform esm module in jest-runtime #15130

Closed kim-jaedeok closed 2 weeks ago

kim-jaedeok commented 3 months ago

Version

29.7.0

Steps to reproduce

  1. clone https://github.com/kim-jaedeok/jest-runtime-report
  2. run the test according to the readme.

Expected behavior

auto-bind is transpiled as a cjs module.

Actual behavior

I know that jest does not support esm module, so if i use esm module, i need to transpile esm module to cjs module via transform. but i have two problems.

  1. if type:"module" is declared in the package.json of an npm package imported from node_modules, an esm module import error occurs before the transform runs.
  2. esmodule is not converted to cjs module after transform is executed, even if type:"module" is not declared.

Additional context

No response

Environment

System:
    OS: macOS 14.2
    CPU: (8) arm64 Apple M2
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.1.1 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

SimenB commented 2 months ago

Can you set up a reproduction without ts-jest? That's not maintained in this repo

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.