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

Add missing act() in tests and fix other test issues #15636

Merged
merged 13 commits into from
Oct 23, 2020

Conversation

ecraig12345
Copy link
Member

Pull request checklist

  • Include a change request file using $ yarn change

Description of changes

Noticed while working on another PR that several components in react-internal were logging errors from their tests about missing act() usage, but those errors weren't causing builds to fail. So this PR adds the missing act() wrappers AND fixes the logging so that errors like this will cause failures in the future. (The issue was that errors thrown in certain async scenarios were being eaten by our mock Async implementation rather than thrown.)

I also made some fixes to scripts/jest/jest-setup.js to reduce the verbosity of act()-related errors

While working on the test fixes, I noticed that many places were using expect(...).toBeDefined() in a way that seemed to assume that the assertion would fail for null as well as undefined, which is NOT the case (it only checks for undefined). Depending on the circumstances, the fix is to use either expect(...).toBeTruthy() or expect(...).not.toBeNull(). I did a search and updated all the places where the usage seemed incorrect.

@DustyTheBot
Copy link

DustyTheBot commented Oct 21, 2020

Warnings
⚠️ There are no updates provided to CHANGELOG. Ensure there are no publicly visible changes introduced by this PR.

Generated by 🚫 dangerJS against 0cc47cf

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 21, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0cc47cf:

Sandbox Source
Fluent UI Button Configuration
codesandbox-react-template Configuration
codesandbox-react-northstar-template Configuration

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Oct 21, 2020

Perf Analysis

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 845 858 5000
BaseButtonCompat mount 928 956 5000
Breadcrumb mount 159161 159469 5000
Checkbox mount 1606 1579 5000
CheckboxBase mount 1351 1374 5000
ChoiceGroup mount 5027 5073 5000
ComboBox mount 1000 992 1000
CommandBar mount 21787 21860 1000
ContextualMenu mount 6216 6303 1000
DefaultButtonCompat mount 1185 1193 5000
DetailsRow mount 3787 3697 5000
DetailsRowFast mount 3831 3846 5000
DetailsRowNoStyles mount 3601 3587 5000
Dialog mount 1643 1559 1000
DocumentCardTitle mount 1922 1941 1000
Dropdown mount 3734 3735 5000
FocusTrapZone mount 1819 1910 5000
FocusZone mount 1833 1773 5000
IconButtonCompat mount 1876 1852 5000
Label mount 350 348 5000
Layer mount 1875 1911 5000
Link mount 467 468 5000
MenuButtonCompat mount 1578 1536 5000
MessageBar mount 2113 2048 5000
Nav mount 3464 3474 1000
OverflowSet mount 1075 1067 5000
Panel mount 1435 1493 1000
Persona mount 880 862 1000
Pivot mount 1496 1463 1000
PrimaryButtonCompat mount 1335 1340 5000
Rating mount 7983 8073 5000
SearchBox mount 1412 1383 5000
Shimmer mount 2717 2709 5000
Slider mount 2032 1988 5000
SpinButton mount 5241 5159 5000
Spinner mount 413 437 5000
SplitButtonCompat mount 3270 3293 5000
Stack mount 535 524 5000
StackWithIntrinsicChildren mount 1650 1618 5000
StackWithTextChildren mount 5080 5055 5000
SwatchColorPicker mount 10763 10710 5000
TagPicker mount 2828 2855 5000
TeachingBubble mount 11841 11923 5000
Text mount 468 458 5000
TextField mount 1458 1528 5000
ThemeProvider mount 2053 2063 5000
ThemeProvider virtual-rerender 672 685 5000
Toggle mount 850 877 5000
button mount 588 588 5000
buttonNative mount 112 118 5000

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🎯 Avatar.Fluent 0.47 0.52 0.9:1 2000 948
🦄 Button.Fluent 0.13 0.25 0.52:1 5000 646
🔧 Checkbox.Fluent 0.68 0.35 1.94:1 1000 676
🎯 Dialog.Fluent 0.17 0.23 0.74:1 5000 859
🔧 Dropdown.Fluent 2.99 0.43 6.95:1 1000 2988
🔧 Icon.Fluent 0.16 0.06 2.67:1 5000 781
🦄 Image.Fluent 0.09 0.13 0.69:1 5000 440
🔧 Slider.Fluent 1.7 0.47 3.62:1 1000 1702
🔧 Text.Fluent 0.08 0.03 2.67:1 5000 412
🦄 Tooltip.Fluent 0.12 0.93 0.13:1 5000 577

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
ChatDuplicateMessagesPerf.default 511 426 1.2:1
ButtonMinimalPerf.default 211 190 1.11:1
TableMinimalPerf.default 500 460 1.09:1
LabelMinimalPerf.default 488 452 1.08:1
VideoMinimalPerf.default 741 685 1.08:1
Text.Fluent 412 385 1.07:1
HeaderMinimalPerf.default 436 412 1.06:1
PortalMinimalPerf.default 169 159 1.06:1
ReactionMinimalPerf.default 462 437 1.06:1
IconMinimalPerf.default 766 725 1.06:1
TextMinimalPerf.default 426 401 1.06:1
ListWith60ListItems.default 998 955 1.05:1
PopupMinimalPerf.default 751 718 1.05:1
Checkbox.Fluent 676 644 1.05:1
ChatMinimalPerf.default 709 679 1.04:1
DividerMinimalPerf.default 429 412 1.04:1
DropdownManyItemsPerf.default 829 797 1.04:1
FlexMinimalPerf.default 338 326 1.04:1
FormMinimalPerf.default 497 479 1.04:1
ImageMinimalPerf.default 454 436 1.04:1
RefMinimalPerf.default 251 242 1.04:1
SliderMinimalPerf.default 1701 1640 1.04:1
TreeWith60ListItems.default 222 214 1.04:1
AttachmentMinimalPerf.default 178 172 1.03:1
ButtonUseCssPerf.default 922 892 1.03:1
ButtonUseCssNestingPerf.default 1155 1125 1.03:1
TableManyItemsPerf.default 2494 2428 1.03:1
TextAreaMinimalPerf.default 576 559 1.03:1
TooltipMinimalPerf.default 872 844 1.03:1
Button.Fluent 646 629 1.03:1
Slider.Fluent 1702 1652 1.03:1
AnimationMinimalPerf.default 450 441 1.02:1
AttachmentSlotsPerf.default 1225 1206 1.02:1
AvatarMinimalPerf.default 513 504 1.02:1
CardMinimalPerf.default 649 635 1.02:1
DropdownMinimalPerf.default 3040 2991 1.02:1
HeaderSlotsPerf.default 888 867 1.02:1
SkeletonMinimalPerf.default 482 471 1.02:1
CustomToolbarPrototype.default 4196 4115 1.02:1
Icon.Fluent 781 769 1.02:1
AlertMinimalPerf.default 364 361 1.01:1
CarouselMinimalPerf.default 507 503 1.01:1
CheckboxMinimalPerf.default 3021 2987 1.01:1
GridMinimalPerf.default 391 389 1.01:1
ListCommonPerf.default 753 743 1.01:1
SegmentMinimalPerf.default 411 406 1.01:1
StatusMinimalPerf.default 803 796 1.01:1
Dialog.Fluent 859 852 1.01:1
ButtonOverridesMissPerf.default 1791 1799 1:1
ChatWithPopoverPerf.default 503 502 1:1
DialogMinimalPerf.default 853 851 1:1
ItemLayoutMinimalPerf.default 1416 1419 1:1
LayoutMinimalPerf.default 467 468 1:1
ListMinimalPerf.default 542 544 1:1
MenuMinimalPerf.default 935 934 1:1
ProviderMergeThemesPerf.default 2090 2093 1:1
RadioGroupMinimalPerf.default 485 483 1:1
SplitButtonMinimalPerf.default 4016 4007 1:1
Dropdown.Fluent 2988 2996 1:1
Image.Fluent 440 440 1:1
BoxMinimalPerf.default 403 406 0.99:1
ButtonSlotsPerf.default 644 652 0.99:1
EmbedMinimalPerf.default 2028 2056 0.99:1
InputMinimalPerf.default 1364 1377 0.99:1
MenuButtonMinimalPerf.default 1727 1737 0.99:1
ProviderMinimalPerf.default 1077 1083 0.99:1
Avatar.Fluent 948 959 0.99:1
AccordionMinimalPerf.default 191 194 0.98:1
LoaderMinimalPerf.default 764 779 0.98:1
ToolbarMinimalPerf.default 1015 1035 0.98:1
TreeMinimalPerf.default 967 1004 0.96:1
Tooltip.Fluent 577 604 0.96:1
ListNestedPerf.default 628 663 0.95:1

@size-auditor
Copy link

size-auditor bot commented Oct 21, 2020

Asset size changes

⚠️ Insufficient baseline data to detect size changes

Unable to find bundle size details for Baseline commit: cfff925

Possible causes

  • The baseline build cfff925 is broken
  • The Size Auditor run for the baseline build cfff925 was not triggered

Recommendations

  • Please merge your branch for this Pull request with the latest master build and commit your changes once again

# Conflicts:
#	packages/react-internal/src/components/Calendar/Calendar.test.tsx
#	packages/react-internal/src/components/DatePicker/DatePicker.test.tsx
@ecraig12345 ecraig12345 merged commit 1491aa2 into microsoft:master Oct 23, 2020
@ecraig12345 ecraig12345 deleted the tests-act branch October 23, 2020 23:18
@msft-github-bot
Copy link
Contributor

🎉@fluentui/utilities@v8.0.0-beta.1 has been released which incorporates this pull request.:tada:

Handy links:

SethDonohue pushed a commit to SethDonohue/fluentui that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants