Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Resolver for mjs files missing #4541

Closed
pappnase99 opened this issue Sep 6, 2024 · 1 comment · Fixed by #4635
Closed

[Bug]: Resolver for mjs files missing #4541

pappnase99 opened this issue Sep 6, 2024 · 1 comment · Fixed by #4635
Labels

Comments

@pappnase99
Copy link

pappnase99 commented Sep 6, 2024

Version

29.2.5

Steps to reproduce

In the documentation under "ESM Support -> Support .mts extension" there is mentioning of a custom resolver under a certain Github link. This link points to a missing resource, also the enclosing directory is missing. I also couldn't find any other example how to set this up.

Since I'm using Typescript, my general question would be is there a way to set up mts/mjs resolution or is this just not possible currently?

Expected behavior

Documentation is up to date.

Actual behavior

Documentation is outdated.

Debug log

See above.

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Binaries:
    Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.3 - C:\Program Files\nodejs\npm.CMD
@ahnpnl
Copy link
Collaborator

ahnpnl commented Sep 7, 2024

The deleted resolver can be found at https://github.com/kulshekhar/ts-jest/blob/v29.2.4/e2e/native-esm-ts/mjs-resolver.ts

In general, ts-jest can’t change file resolution so the only way to achieve what you need is creating a custom resolver in your project, similar to the example one.

We are happy to have a resolver included in this project too so anyone in need can also use that by specifying it in Jest config

The popular one I use is this https://github.com/nrwl/nx/blob/master/packages/jest/plugins/resolver.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants