-
Notifications
You must be signed in to change notification settings - Fork 455
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
What does the new major release of Jest (24) means for this library #961
Comments
This is a good question, I have the same one as well. I'm getting peer dependency warnings but so far it works with Jest 24. The 24 docs also state:
So it doesn't seem like it replaces ts-jest entirely? |
This page, linked from the readme, outlines some other shortcomings of Babel's support; I wonder if these are still accurate? |
To be entirely honest, I think (and hope) that this is the start of something that ends with native typescript support in Jest. There's a good chance of that given that Jest itself is moving away from flow to use ts. Even in its current state, I think using typescript via babel should be the way to go for testing. Type-checking should be separate from testing and I know this isn't a universally shared opinion (we've had disagreements even amongst the contributors here on this) so I'll try to do what needs to be done to add Jest 24 support in ts-jest via a new version as soon as I can set aside a few hours (or a day) for this |
Is it possible that ts-jest will merge with jest itself? |
I think it'd be more like ts-jest being rendered redundant |
There are some limitations for babel7 TS transpilation, that, for the near future (I hope only for the near), Until we will have a way to overcome these limitations, ts-jest or other setup that runs tsc before babel is a must |
This is time limited advantage to this library, but sooner or later they will implement it. So my suggestion is that jest and ts-jest will merge This will have some advantages:
|
Some things are probably never going to be possible using Babel to transpile Typescript. The only one I doubt we'll actually see fixed is |
In the meantime: Does it make sense to bump the peer dependency to 24 to get rid of the warning message as ts-jest seems to work just fine with jest v24? |
Yes, came here with same question - is it possible to disable |
- upgrade to jest 24, keep ts-node in the background as babel would probably not work here - more info about the warning ts-jest kulshekhar/ts-jest#961
@kulshekhar Could be possible to release a package to support v24 (peerDependencies)? It seems that everything is ok, just to remove annoying warnings. |
Exactly. And if it's discovered that something is broken - people will open another issue:) |
@artola sure, if it works, I'd be happy to merge in a quick PR for this
It's just that I haven't been able to find time for this and I was a bit hesitant to do something that could give users a false sense of security |
@kirillgroshkov Internal tests and CI are there for a very good reason, if they run properly means that as far as we can and known, it is safe to go on. |
Oh, great! Someone want to do such quick PR? |
It looks like bumping the version was attempted in #957 but the builds failed |
Did a quick PR here: #973 |
@kirillgroshkov @kulshekhar Moving to jest v24 also means that My tests break with the following error:
@kulshekhar some hint how to solve it? |
+1. Please do it! :) Using with Jest 24 (for typechecking on tests) and everything is fine here. |
looking at this now |
I've pushed a commit on #957 which should hopefully get things moving. Big caveat - I haven't reviewed the rest of the PR |
Is there any success? |
@JustFly1984 Watch #957 |
@thymikee @kulshekhar Regarding the issue with babel and the cached config ts-jest/src/config/config-set.ts Line 348 in 1ac501a
I hope that this is the tip of the iceberg, but for sure it is not a fix, neither I have a complete understanding of of the other conditions around this block. |
the solution is to call See https://github.com/babel/babel/blob/master/packages/babel-core/src/config/index.js and https://github.com/babel/babel/blob/master/packages/babel-core/src/config/partial.js |
@Jessidhia @kulshekhar Your are right, with What should be done here? because your PR #960 also contains this comment from @SimenB #960 (comment) |
For anyone reading this thread who is considering migrating to Babel's built-in TypeScript support, aside from the points mentioned in the aforementioned blog post, there's also a major bug in the Jest integration, which is that TS shorthand class properties using To clarify, this problem is with Babel's built in TS support, not with ts-jest. I'm just posting this here for anyone who, like me, is considering migrating due to the |
We have no plans to include type checking in Jest (TS, Flow or otherwise). If anything around type checking would happen inside of Jest, it would be enabling runners like https://github.com/azz/jest-runner-tsc to be as good a solution it can be (e.g. allowing it to spin up a TS server once it can query instead of doing file by file etc.).
I personally agree with this, but I also very much understand those that think tests should be type checked before they are run. So I think there'll always be a place for Any concrete proposals for changes we can make in Jest that would simplify |
@kulshekhar We are upgrading to react-native 0.58., and basically we are having to get rid of the usage of |
@shercoder it's hard for me to answer that as I don't know what parts of ts-jest need to be updated to get this working. I'm actively trying to find a window of a couple of days to
to bring ts-jest up to speed. I haven't been able to find this kind of a window for a while now but hope I'll be able to soon. |
* almost done with all conversation controller acceptance tests * Better redis mock and some more add.posts tests * finished tests for conversation controller * replace __tests__ with inline tests * lock jest to latest version of 23 to avoid ts-jest warnings: - kulshekhar/ts-jest#961 * inbound controller tests * added test runner for api * Add api test runner to github actions * Prevent early termination of tests * potentially fix syntax issue * Fix build arg * actually mock redis - fix errors throw in tests * update readme and failing test example * fix failing test (poc) * fix redis publishing issue due to wrong method call * split integration controller into pieces - prepare for testing * finish integration controller tests and clean up setup steps in other tests * remote debugging for ui * enable vscode debugging for all javascript apps + jest * fix issue with stripe integration using SSR * migrate team controller to new controller architecture * move user controller to new format * updated readme
@SimenB maybe can separate type checking into another node process ? See https://github.com/microsoft/TypeScript/wiki/Performance#concurrent-type-checking |
Possibly, some discussion in azz/jest-runner-tsc#20 |
Actually, we disable type-checking when running ts-jest (diagnostics=false), for performance. And do That's what we do in CI. In local development we're ok to ignore type errors in tests, cause either they can be caught at a later stage, or tests will fail anyway because something is undefined/missing. |
Yes definitely compiling before running all tests is faster since it is sequence task. When running tests with typescript If anyone has more ideas about improving performance for |
Is this expanded on somewhere? I've not been able to understand the benefits of type checking in a test runner (particularly the errors not being filterable by Jest) outside of possible familiarity. It runs counter to the common iterative/exploratory/tinkering workflow with short feedback loops. It's why, for example, linter errors would typically break a production build but not a development server. What ultimately matters is that the code with errors isn't merged, but the developer should be able to make the call to ignore it while developing. |
What does the new major release of Jest (version 24) mean to this library?
In the Jest announcement for version 24 was written:
The text was updated successfully, but these errors were encountered: