-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Unit Test coverage for @carbon/react
components ☂️
#16319
Comments
I'd love to see this include adding something like a codecov ci check on our PRs. |
Related issue: Research and implement a testing strategy for types provided through @carbon/react |
One example of this that I just ran into that we should consider: Tests covering callback props should always assert both how many times it's called and what it's called withexpect(onChange).toHaveBeenCalledTimes(1);
expect(onChange).toHaveBeenCalledWith(arg1, arg2, ...); Numerous times we've fixed bugs relating to callbacks being called multiple times or not at all. We've also had plenty of times where the contents of the callback args change unintentionally. Let's make sure we always test both. There's probably not a way to automatically enforce this, but it's a style/practice we should adopt everywhere imo |
Additionally we should look at any playwright test that is
We recently found a case were the tile avt tests were actually failing locally, but passing in CI. It seems the reason was that the tests were timing out and not producing an error in ci. Locally they would fail. We should evaluate to ensure all the tests we have pass individually locally. |
@tay1orjones The timing of your comment was impeccable. @ariellalgilmore and I were investigating some flakiness on our end as you wrote this. 😹 |
@carbon/react
components ☂️
Kickoff notesCollecting coverage
Reading the coverage report
Other notes
Tips for test writing
|
adding https://codewithhugo.com/jest-exclude-coverage/ as a resource. In Jest 100% coverage might not be possible because it's not a "real" browser setting. For example, when testing for overflow the tests will never pick it up. The linked guide explains how to ignore or exclude files when necessary |
The goal of this workstream is to increase confidence in each component, not just to increase coverage. It’s better to have 80% coverage with high-quality tests than 100% coverage with low-quality tests.
If you want to tackle any research, just create an issue to keep your notes from the research. Would be nice to look for repos that are using that on their PRs, to take as an example.
Important
Read the kickoff notes below for implementation instructions and tips
Add code coverage CI check
High priority components under 80% coverage
ContainedList
unit test coverage #17470ListBox/next/ListBoxSelection
unit test coverage #17471ProgressIndicator.Skeleton
unit test coverage #17472Layout
unit test coverage #17473RadioTile
unit test coverage #17474TextInput.Skeleton
unit test coverage #17475ControlledPasswordInput
unit test coverage #17476Dropdown
unit test coverage #17477FluidTextArea.Skeleton
unit test coverage #17478FilterableMultiSelect
unit test coverage #17479MultiSelect
unit test coverage #17480Tile
unit test coverage #17481Theme
unit test coverage #17482FileUploader
unit test coverage #17483FileUploaderDropContainer
unit test coverage #17484ModalWrapper
unit test coverage #17485FluidComboBox.Skeleton
unit test coverage #17486FluidSelect.Skeleton
unit test coverage #17487HeaderContainer
unit test coverage #17488HeaderMenu
unit test coverage #17489HeadePanel
unit test coverage #17490SideNav
unit test coverage #17491SideNavMenu
unit test coverage #17492Switcher
unit test coverage #17493SwitcherItem
unit test coverage #17494Pagination.Skeleton
unit test coverage #17495Pagination
unit test coverage #17496TimePicker
unit test coverage #17497Toggletip
unit test coverage #17498OverflowMenu
unit test coverage #17499Slug
unit test coverage #17500TreeNode
unit test coverage #17501TreeView
unit test coverage #17502Tag
unit test coverage #17503DismissibleTag
unit test coverage #17504OperationalTag
unit test coverage #17505ToggleSmall.Skeleton
unit test coverage #17506OverflowMenuV2
unit test coverage #17507StructuredList
unit test coverage #17508StructuredList.Skeleton
unit test coverage #17509FluidDatePicker.Skeleton
unit test coverage #17510FluidDropdown.Skeleton
unit test coverage #17511FluidNumberInput.Skeleton
unit test coverage #17512FluidSearch.Skeleton
unit test coverage #17513FluidPasswordInput
unit test coverage #17514FluidTextInput.Skeleton
unit test coverage #17515FluidTimePicker.Skeleton
unit test coverage #17516FluidTimePicker
unit test coverage #17517FluidMultiSelect.Skeleton
unit test coverage #17518FluidMultiSelect
unit test coverage #17519Flaky tests to fix
The text was updated successfully, but these errors were encountered: