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

0.9.0-fb2 slow tests with jest.runCLI() via Gulp #722

Closed
irudoy opened this issue Feb 19, 2016 · 21 comments
Closed

0.9.0-fb2 slow tests with jest.runCLI() via Gulp #722

irudoy opened this issue Feb 19, 2016 · 21 comments

Comments

@irudoy
Copy link
Contributor

irudoy commented Feb 19, 2016

I'm running tests with jest.runCLI() via Gulp, and it still takes a lot of time. Also, when tests have been passed, gulp task doesn't exit and loading CPU at 80%. If I run it with npm test, all is ok.

Example:
https://github.com/irudoy/jest/tree/master/examples/gulp

@irudoy irudoy mentioned this issue Feb 19, 2016
@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

Thanks! Do you have any ideas as to why this might be happening or could you help troubleshooting this a bit? :)

@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

I'm trying to find it out. Have you tried to reproduce this?

@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

Cache dir listings:

$ gulp test

# node_modules/jest-cli/.haste_cache

-rw-r--r--  1 rudoy  staff   423B Feb 19 12:23 046f5d28f6f3af6548c0f53e5c93ebc6
-rw-r--r--  1 rudoy  staff    80B Feb 19 12:23 perf-cache-undefined

$ npm test

# node_modules/jest-cli/.haste_cache

-rw-r--r--    1 rudoy  staff   505B Feb 19 12:24 046f5d28f6f3af6548c0f53e5c93ebc6
-rw-r--r--    1 rudoy  staff    80B Feb 19 12:24 perf-cache-undefined
drwxr-xr-x  116 rudoy  staff   3.9K Feb 19 12:24 preprocess-cache

@quantizor
Copy link
Contributor

I have also noticed that the process doesn't quit when the tests are finished with fb1. I'll try to dig around tomorrow and see if it's a config-related bug.

@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

@yaycmyk What happens when you comment out this part: https://github.com/facebook/jest/blob/master/src/resolvers/HasteResolver.js#L117 ?

@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

Ah yeah, the process quit issue, we figured it out and I'll publish fb2 soon.

@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

👍

@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

I'm pretty sure this is resolved with fb2. Can you try and let me know if it is still an issue? If you are using watchman, try --no-watchman if it doesn't work, to double check :) Let's reopen if this still repros.

@cpojer cpojer closed this as completed Feb 19, 2016
ghost pushed a commit that referenced this issue Feb 19, 2016
Summary:Fixes #714, probably also #722 and also facebook/react-native#6019
Closes #724

Differential Revision: D2953708

fb-gh-sync-id: 110a30d6c11256644c8e4f7ab1d7b7cb5fa1b021
shipit-source-id: 110a30d6c11256644c8e4f7ab1d7b7cb5fa1b021
@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

Process is quitting now :)
But, this issue seems to be actual:

I'm running tests with jest.runCLI() via Gulp, and it still takes a lot of time. If I run it with npm test, all is ok.

This example is very simple, and difference is minor:
https://github.com/irudoy/jest/tree/master/examples/gulp
One test takes ~0.7s with jest.runCLI() and ~0.5s with npm test.

But on my real world project, each test takes ~10-12s with jest.runCLI() and ~0.7-1.2s with npm test.

@irudoy irudoy changed the title 0.9.0-fb1 slow tests with Gulp 0.9.0-fb2 slow tests with Gulp Feb 19, 2016
@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

@cpojer reopen pls

@cpojer cpojer reopened this Feb 19, 2016
@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

I'm afraid without a proper repro case I can't do much. The 200ms in the example is probably just variance.

@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

@cpojer do you know any big project with a lot of tests using Jest, in which we could check this?

@cpojer
Copy link
Member

cpojer commented Feb 19, 2016

https://github.com/facebook/relay is a good benchmark.

@irudoy
Copy link
Contributor Author

irudoy commented Feb 19, 2016

@cpojer thnx, I will try this

@irudoy
Copy link
Contributor Author

irudoy commented Feb 20, 2016

https://github.com/irudoy/relay/tree/gulp-jest-test

npm test ~25-26s
gulp test (jest.runCLI()) ~56-60s

@cpojer

@cpojer
Copy link
Member

cpojer commented Feb 20, 2016

thank you so much for making a repro! I'll take a look after the weekend. Would you mind telling me the difference between those two commands on your personal projects with 0.8.2? Were they both at the same (slow! :D ) speed?

@irudoy irudoy changed the title 0.9.0-fb2 slow tests with Gulp 0.9.0-fb2 slow tests with jest.runCLI() via Gulp Feb 20, 2016
@irudoy
Copy link
Contributor Author

irudoy commented Feb 20, 2016

@cpojer hmm, npm test is a little bit faster, than jest.runCLI() @0.8.2 with warm cache. It seems that jest.runCLI() does not use cache at all

@cpojer
Copy link
Member

cpojer commented Feb 25, 2016

Hey @irudoy would you mind sharing what the runtime of jest.runCLI is on 0.8.2? If it's the same as with 0.9.0, then I'll go ahead and publish 0.9.0 and fix this bug as a follow-up patch release. Trying to get 0.9.0 out of the door first :) If you have some time to investigate why this happens yourself, that would be fantastic too. As you mentioned, it does seem like for some reason it isn't being using the preprocess-cache, so it might make sense to look into why that config is disabled.

@cpojer
Copy link
Member

cpojer commented Mar 16, 2016

@irudoy is this still an issue?

@irudoy
Copy link
Contributor Author

irudoy commented Mar 24, 2016

@cpojer unfortunately, I have not time to check this now

@irudoy irudoy closed this as completed Mar 24, 2016
@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 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants