You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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:
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.
The text was updated successfully, but these errors were encountered:
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.
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 usemoduleNameMapper
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.
The text was updated successfully, but these errors were encountered: