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

Typescript/Jest performance issues #3806

Open
tombanksme opened this issue May 17, 2024 · 2 comments
Open

Typescript/Jest performance issues #3806

tombanksme opened this issue May 17, 2024 · 2 comments

Comments

@tombanksme
Copy link

tombanksme commented May 17, 2024

We've recently updated one of our typescript projects from date-fns ^2.30.0 to ^3.6.0.

Since then we've seen massive increases in runtime for our jest tests; on my M1 MacBook Pro our test suite increased from 87s to 292s after updating date-fns.

Package Versions:

typescript == 5.4.5
ts-jest == 29.1.2
jest == 29.7.0
date-fns == 3.6.0

If I rollback using npm install date-fns@2 the test duration returns to normal. Has anyone else ran into this issue?

@fturmel
Copy link
Member

fturmel commented May 17, 2024

That's a little puzzling... If anything it should be a bit faster because there are less conversions and checks at runtime.

A focused reproduction of the problem would be helpful.

Some ideas:

@tombanksme
Copy link
Author

tombanksme commented May 20, 2024

Edit: actually after looking at the Typescript documentation it doesn't look like there's any appropriate alternatives to use as a work-around (the default is node16)

Thanks for the response. I've found the problem (reproduction repo). We use @node20/tsconfig as our base Typescript configuration which sets moduleResolution to node16

If you remove it from the tsconfig.json the runtime of the tests in the reproduction repo go from ~1.3s to ~0.5s. This change doesn't break anything in our project; I'm not sure how you want to document/fix this incompatability in date-fns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants