This is a feature request.
Issue
Our team is working on a large codebase and we are currently having issues with the time our CI takes. We are looking at all the ways to make the build faster.
One of the bottlenecks is the time it takes to run the tests. We investigated and most of time taken to run unit tests is not to actually run the tests but to compile the TS files on-the-fly.
Expected behavior
The thing is that TS files have already been compiled as part of the build step. We would love for ts-jest to leverage this and rely on them.
One idea is to have ts-jest write the compiled files on disk and leverage the incremental option. As ts-jest attempts to recompile the code, tsc will see that most of the work was already done.
We understand this is a large undertaking and I am ready to help! From a quick glance I already identified ts-jest performs additional transformation to hoist jest.mock() and that could be a challenge.
Alternatives
We found none of the speed-up alternatives to be satisfying. They are:
- Compile the test files ahead of time. It works great but we lose snapshots and it's a poor developer experience. Not a good fit.
- Compile with babel instead of ts-jest. It's still slow, it doesn't support all of TypeScript features, the TDD experience is not as good and the code that is tested in not the one that actually runs in production. Not a good fit.
We would largely prefer to stick with ts-jest but performance improvements are really necessary for us. Again, I'm ready to work on it.
What do you think about this feature, and would you support a PR introducing it?
This is a feature request.
Issue
Our team is working on a large codebase and we are currently having issues with the time our CI takes. We are looking at all the ways to make the build faster.
One of the bottlenecks is the time it takes to run the tests. We investigated and most of time taken to run unit tests is not to actually run the tests but to compile the TS files on-the-fly.
Expected behavior
The thing is that TS files have already been compiled as part of the build step. We would love for ts-jest to leverage this and rely on them.
One idea is to have ts-jest write the compiled files on disk and leverage the
incrementaloption. As ts-jest attempts to recompile the code, tsc will see that most of the work was already done.We understand this is a large undertaking and I am ready to help! From a quick glance I already identified ts-jest performs additional transformation to hoist
jest.mock()and that could be a challenge.Alternatives
We found none of the speed-up alternatives to be satisfying. They are:
We would largely prefer to stick with ts-jest but performance improvements are really necessary for us. Again, I'm ready to work on it.
What do you think about this feature, and would you support a PR introducing it?