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

Is Jest + TypeScript ready for prime time? #5906

Closed
jamietre opened this issue Mar 30, 2018 · 2 comments
Closed

Is Jest + TypeScript ready for prime time? #5906

jamietre opened this issue Mar 30, 2018 · 2 comments

Comments

@jamietre
Copy link
Contributor

jamietre commented Mar 30, 2018

I've spent the last several days trying to stand up Jest within an existing (large) project. It's using webpack and babel + typescript. Each of these issues has come up:

1) Source maps line numbers are incorrect. When a test fails, it shows an excerpt from the test code, and the arrow points to the wrong line. The line number shown in the stack trace is also wrong. It could be:

kulshekhar/ts-jest#334

.. but in this issue, only the stack trace # is wrong, whereas the excerpt is pointing to the right line.
Could be this issue, but it's closed:

#5446

So I'm not sure if this problem has to do with existing issues or it's something new. This isn't a showstopper, so I moved on.

First thing I found trying to migrate a test is that mocks didn't seem to be working, and I finally figured out it was because of this:

2) jest.mock doesn't work for modules that use moduleNameMapper to transform them

#4262

So I decided to write my own resolver since we have a lot of webpack config (basically, everything needs to use moduleNameMapper) and I got as strange error, turns out I'm bumping against yet another issue:

3) custom resolver not working

#4025

I haven't yet figured out how to work around this one. There doesn't seem to be a solution.

It seems like each time I try to figure out some way to work around a problem, I bump into a new unresolved bug. This seems like an awful lot of problems for what I think is a fairly standard use case. Am I missing something, or just doing it wrong? Or are these issues related to TypeScript + Jest and maybe there just aren't that many people using Jest with Typescript yet? I thought this was going to be painless to get up and running, but so far it seems anything but.

@rickhanlonii
Copy link
Member

Hey @jamietre, this issue tracker is not a help forum (as stated in issue template)

We recommend using our discord channel or StackOverflow where there is an active jestjs tag for questions

@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 May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants