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]: Typescript compilation errors cause Jest to hang silently #12832

Closed
NiekPas opened this issue May 10, 2022 · 3 comments
Closed

[Bug]: Typescript compilation errors cause Jest to hang silently #12832

NiekPas opened this issue May 10, 2022 · 3 comments

Comments

@NiekPas
Copy link

NiekPas commented May 10, 2022

Version

28.1.0

Steps to reproduce

  1. Close repo at https://github.com/NiekPas/jest-hangs.git
  2. Run npm i
  3. Run npm run test

Expected behavior

I expect Jest to output a compilation error or other indication that the test could not be run.

Actual behavior

Jest hangs indefinitely.

Additional context

I'm not sure if this is a jest bug or a ts-jest bug. Please let me know if I should move this issue and I will happily do so.

May be due to the use of ESM?

ts-jest version is 28.0.1.

Environment

System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
  npmPackages:
    jest: ^28.0.3 => 28.1.0
@mrazauskas
Copy link
Contributor

Seems like ts-jest issue. The test fails as expected with this jest.config.js:

export default {
  extensionsToTreatAsEsm: [".ts"],
  transform: {},
};

There is nothing to transform in your example. Hence, a transformer should either throw an error, or do nothing and let the test fail at runtime. transform: {} makes sure that transformers are not involved and as you can see Jest reports that the test failed as expected.

@NiekPas
Copy link
Author

NiekPas commented May 11, 2022

I've moved the issue to the ts-jest repo: kulshekhar/ts-jest#3507

@NiekPas NiekPas closed this as completed May 11, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants