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

chore(package): switch to Jest #2971

Closed
wants to merge 44 commits into from
Closed

chore(package): switch to Jest #2971

wants to merge 44 commits into from

Conversation

layershifter
Copy link
Member

WIP

Oleksandr Fediashov added 14 commits July 2, 2018 11:00
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
@layershifter
Copy link
Member Author

@levithomason it's interesting, but Jest is much slower than our existing solution. I've pulled stardust and seen that there are same problems:

 PASS  test/specs/lib/eventStack/EventTarget-test.ts (8.016s)
 PASS  test/specs/lib/htmlInputPropsUtils-test.ts
 PASS  test/specs/lib/doesNodeContainClick-test.ts (11.209s)
 PASS  test/specs/lib/eventStack/eventStack-test.ts (11.271s)
 PASS  test/specs/lib/factories-test.tsx (11.314s)

I think that it's quite slow. Did I miss something?

@levithomason
Copy link
Member

Strange, I have no idea. @davezuko?

@dvdzkwsk
Copy link
Member

dvdzkwsk commented Jul 3, 2018

Maybe a Windows issue? The test suite runs in 8s for me on a cold start, and 4.75 on subsequent runs.

@layershifter
Copy link
Member Author

layershifter commented Jul 3, 2018

SUIR

I will try to update tests for views fully and then will followup again.

Our existing suite is running 02:26: https://circleci.com/gh/Semantic-Org/Semantic-UI-React/5649
Current suite (/lib only) runs 00:54: https://circleci.com/gh/Semantic-Org/Semantic-UI-React/5644

Current suite (/lib and /views) locally:

Test Suites: 5 failed, 60 passed, 65 total
Tests:       13 failed, 1789 passed, 1802 total
Snapshots:   0 total
Time:        92.138s (01:32)

There are many failed tests, but it looks very poorly.

@layershifter
Copy link
Member Author

layershifter commented Jul 3, 2018

Stardust

 PASS  test/specs/lib/doesNodeContainClick-test.ts (9.266s)
 PASS  test/specs/lib/factories-test.tsx (9.416s)
Test Suites: 24 passed, 24 total
Tests:       6 skipped, 351 passed, 357 total
Snapshots:   0 total
Time:        32.258s

Ubuntu 16.04
i7 2637m

Looks bad to me, too.

@layershifter
Copy link
Member Author

I'm worried that after switching to Jest, our tests will be performed substantially longer.


If I omit Babel and write code/tests in raw JS, tests are running blazing fast. Looks like Babel has a cold start on each test 🤔

Oleksandr Fediashov added 8 commits July 13, 2018 17:01
…React into chore/jest

Signed-off-by: Oleksandr Fediashov <[email protected]>

# Conflicts:
#	test/specs/elements/Input/Input-test.js
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
…React into chore/jest

Signed-off-by: Oleksandr Fediashov <[email protected]>

# Conflicts:
#	test/specs/lib/eventStack/EventPool-test.js
#	test/specs/lib/eventStack/EventStack-test.js
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
@@ -45,7 +45,7 @@ jobs:
command: yarn lint
- run:
name: Test JavaScript
command: yarn test
command: yarn test --runInBand

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the cause of slow tests, as they are run serially. Try to leverage number of cores you can use on your CI, try different ones, e.g. yarn test -w=4 for 4 parallel workers. Some CIs are better and some worse in using multiple cores, that's why you need to play with it a bit

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I was talking about using certain number of workers, not all available (depending on CI, it can tell Jest it has even 128 cpus). You should be good to run jest without flags locally, as you probably have up to 8 cores and enough memory.

@codecov-io
Copy link

codecov-io commented Jul 16, 2018

Codecov Report

Merging #2971 into master will decrease coverage by 32.28%.
The diff coverage is 85.03%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #2971       +/-   ##
===========================================
- Coverage   99.96%   67.67%   -32.29%     
===========================================
  Files         163       76       -87     
  Lines        2743     1324     -1419     
  Branches        0      229      +229     
===========================================
- Hits         2742      896     -1846     
- Misses          1      428      +427
Impacted Files Coverage Δ
src/views/Feed/FeedLabel.js 100% <ø> (ø) ⬆️
test/specs/commonTests/hasSubcomponents.js 100% <100%> (ø)
test/utils/consoleUtil.js 100% <100%> (ø)
test/specs/commonTests/hasValidTypings.js 100% <100%> (ø)
test/utils/componentInfo.js 100% <100%> (ø)
test/specs/commonTests/implementsClassNameProps.js 100% <100%> (ø)
test/setupTests.js 100% <100%> (ø)
test/specs/commonTests/classNameHelpers.js 100% <100%> (ø)
test/specs/commonTests/implementsCreateMethod.js 100% <100%> (ø)
test/specs/commonTests/hasUIClassName.js 100% <100%> (ø)
... and 189 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9e0aae...84ccef1. Read the comment docs.

Oleksandr Fediashov added 22 commits July 16, 2018 12:23
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
Signed-off-by: Oleksandr Fediashov <[email protected]>
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

Successfully merging this pull request may close these issues.

5 participants