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

RFC: Performance after upgrading from 25.2.1 to 25.3.0 #1470

Closed
MykytaKryvenko opened this issue Mar 30, 2020 · 22 comments · Fixed by #1483
Closed

RFC: Performance after upgrading from 25.2.1 to 25.3.0 #1470

MykytaKryvenko opened this issue Mar 30, 2020 · 22 comments · Fixed by #1483

Comments

@MykytaKryvenko
Copy link

Issue :

25.3.0 version is extremely slow compared to 25.2.x.
E.g. my previous test runs were 17s, and 135s after update.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 30, 2020

can you please provide more information ? Do you run with or without cache ? Did you clear cache after upgrading to 25.3.0 ?

@MykytaKryvenko
Copy link
Author

I tried to run jest with --clearCache, did not help.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 30, 2020

from what I can see is, before upgrading probably your tests ran with cache. After upgrading, old cache becomes invalid so tests will need to cache again. That's why you saw a big difference. Several steps that you can help us to verify is:

  • Clear cache
  • Run tests with --no-cache for 25.2.1
  • Clear cache again
  • Run tests with --no-cache for 25.3.0

If the amount of time tests take is the same for these above steps, it means no downgrade

@MykytaKryvenko
Copy link
Author

Thank you for the suggestion, but it did not help as well :(
After all steps and running with no-cache it takes ~270s to finish.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 30, 2020

Hmm I don’t see any issues on my side. Also confirmed from #1450 (comment)

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 30, 2020

Any chances to have your repo to try out ?

@MykytaKryvenko
Copy link
Author

Unfortunately no.
We have pinned version for now. Maybe someone else will face this issue too.

@ahnpnl ahnpnl changed the title Performance downgrade after 25.3.0 release RFC: Performance after upgrading from 25.2.1 to 25.3.0 Mar 30, 2020
@ahnpnl ahnpnl pinned this issue Mar 30, 2020
@bmesuere
Copy link

Maybe it's related but moving to 25.3.0, it seems that a lot more files are getting compiled. We use this in a rails project and are now getting a bunch of errors like error TS5055: Cannot write file '/<<path>>/config/webpack/development.js' because it would overwrite input file. which suggests it now handles every js file in repository.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 31, 2020

Maybe it's related but moving to 25.3.0, it seems that a lot more files are getting compiled. We use this in a rails project and are now getting a bunch of errors like error TS5055: Cannot write file '/<<path>>/config/webpack/development.js' because it would overwrite input file. which suggests it now handles every js file in repository.

thanks for your feedback. Do you use allowJs in your repo ?

@bmesuere
Copy link

yes, I do. After checking the other issues, I think #1472 will probably resolve the error for me.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 31, 2020

Thanks. Probably the issue is bigger than just the fix #1472 as you mentioned that there are more files getting compile. That is a useful hint to solve this issue.

Up til now, imo #1472 is just a workaround and there should be a proper fix.

@MykytaKryvenko
Copy link
Author

I want to add that we are using allowJs too, without it compilation fails for 25.3.0, but works for 25.2.1

@ahnpnl
Copy link
Collaborator

ahnpnl commented Mar 31, 2020

if you guys don't mind, please test with this tgz file. I just made an attempt to fix it but not so sure.

@LasaleFamine
Copy link

I'm hitting the same problem just after the upgrade to 25.3.0 and I have a lot of:
Cannot write file 'path/to/file.js' because it would overwrite input file

I'm using allowJs too. Also if I add the outDir tests will work but they are extremely slow.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 1, 2020

hi guys, please test again this branch https://github.com/ahnpnl/ts-jest/tree/fix-diagnostics to see if it helps

@LasaleFamine
Copy link

LasaleFamine commented Apr 1, 2020

Seems like I cannot install it from GitHub with yarn add --dev -W https://github.com/ahnpnl/ts-jest#fix-diagnostics. Here is the error:

$ npm run build
npm WARN lifecycle The node binary used for scripts is /var/folders/sl/w6pt8g5j2b332rk_776pwdbc0000gn/T/yarn--1585747708265-0.824303838895643/node but npm is using /Users/occhipintia/.nvm/versions/node/v10.13.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] prebuild /Users/occhipintia/Library/Caches/Yarn/v6/.tmp/5c55e78258b66b7b689625fcb8d6906e.dd8b2e4e117869706228fab75b0ba68f183752f0.prepare
> node scripts/clean-dist.js


> [email protected] build /Users/occhipintia/Library/Caches/Yarn/v6/.tmp/5c55e78258b66b7b689625fcb8d6906e.dd8b2e4e117869706228fab75b0ba68f183752f0.prepare
> tsc -p tsconfig.build.json

src/cli/config/migrate.ts:3:32 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.

3 import * as stringifyJson from 'fast-json-stable-stringify'
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NOTE: I'm in a monorepo.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 1, 2020

Here is the zip of the tgz file.
ts-jest-25.3.1.tgz.zip

@LasaleFamine
Copy link

LasaleFamine commented Apr 1, 2020

Alright, seems like we have some good news: installed the new version from your zip I can run the tests without the Cannot write file 'path/to/file.js' because it would overwrite input file error.

Also I have notice the slowness just the first time I run it, but the second run, using the cache, it goes down to 5 seconds running all tests. So I can say the last fix solved the problem. Looking forward for the 25.3.1 release!

It is also worth to say that I haven't changed my tsconfig.json to make this work again.

Thanks for your time @ahnpnl!

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 1, 2020

thanks a lot for helping us !. I will make a PR shortly 👍

@MykytaKryvenko
Copy link
Author

@ahnpnl, thanks a lot for the fix! Do you know when it will be released?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Apr 3, 2020

we are having a bit issue with publishing today, but will be solved shortly. Stay tune :)

Updated: 25.3.1 is out

@kirillgroshkov
Copy link
Contributor

Yes, we also experienced perf degradation. Will test with 25.3.1

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

Successfully merging a pull request may close this issue.

5 participants