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

jest-runtime, jest-transform: share cacheFS between runtime and transformer #10898

Closed
ahnpnl opened this issue Dec 1, 2020 · 3 comments · Fixed by #10901
Closed

jest-runtime, jest-transform: share cacheFS between runtime and transformer #10898

ahnpnl opened this issue Dec 1, 2020 · 3 comments · Fixed by #10901

Comments

@ahnpnl
Copy link
Contributor

ahnpnl commented Dec 1, 2020

🚀 Feature Proposal

Currently, when ts-jest/jest-preset-angular performs code compilation + type checking with TypeScript LanguageService/Program, TypeScript will attempt to do module resolution itself to gather enough information for the process.

The problem is when doing module resolution, TypeScript will also perform fs.readFileSync to get file content. So we end up in the situation that some files which are already read by TypeScript will be read again by Jest, which causes extra I/O on disk.

Therefore, I'd like to propose a feature request that jest-runtime shares cacheFS with jest-transform. The idea is that custom transformer can get/set this cacheFS so that already-read files shouldn't be read again.

The prototype implementation is: jest-runtime passes cacheFS to ScriptTransformer, ScriptTransformer passes that cacheFS to process.

Motivation

Improve performance by reducing I/O.

Example

This will help ts-jest/jest-preset-angular to speed up test run with isolatedModules: false

Pitch

The implementation will require changes in jest-runtime and jest-transform so it is core of Jest.

cc @thymikee @SimenB

@SimenB
Copy link
Member

SimenB commented Dec 2, 2020

That sounds like a good idea to me. Wanna send a PR?

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Dec 2, 2020

Sure 👌

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

Successfully merging a pull request may close this issue.

2 participants