-
Notifications
You must be signed in to change notification settings - Fork 150
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: upgrde jest to v29 #1473
Conversation
|
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 1885bc2:
|
✅ PR title follows Conventional Commits specification. |
0bade07
to
0f48cd6
Compare
@@ -0,0 +1,34 @@ | |||
diff --git a/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js b/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this patch? I'm seeing some fixes regarding this on reanimated repo can we upgrade reanimated to latest minor and check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgraded reanimated and it works!
I don't know why that issue is still open, I thought it wasn't fixed in master.
.c0 { | ||
display: -webkit-box; | ||
display: -webkit-flex; | ||
display: -ms-flexbox; | ||
display: flex; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that all the generated CSS got removed from snapshots this should not happen as we deliberately enabled snapshots to include the CSS rules. Maybe check styled-components repo for jest 29 guides
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, it seems jest-styled-components
is not compatible with jest v28+.
@@ -11,6 +11,8 @@ import type { AccessibilityMap, AccessibilityProps } from './types'; | |||
export const makeAccessible = (props: Partial<AccessibilityProps>): Record<string, unknown> => { | |||
const newProps: Record<string, any> = {}; | |||
|
|||
newProps.accessible = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might cause issues on react-native and change accessibility behaviours, because now anywhere we have used makeAccessible will cause that element to become a single selectable element and won't be able to select the nested elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anuraghazra But we are adding accessible={true}
to the elements only which have other accessibility props, like accessibilityLabel
, etc so it should be fine. Having other accessible props means, we do want to make the component accessible, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thik hai i'll test the a11y on my device once and let you know if this is causing some issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay tested each component manually on RN, most of them looks good.
There are some minor changes like in Indicator component now consumers won't be able to go into the text node and read out the "Success" text
But i think this is fine because it still announces the accessibilityLabel as "Status ok".
Anyway if we want to manually disable accessible prop we can just pass accessible: false
when using makeAccessible, so we will just need to be a bit careful.
@snitin315 rebase with master first so chromatic optimisations can kick in? |
305dd34
to
3fa56a3
Compare
BundleMonFiles updated (1)
Unchanged files (13)
Total files change +8B 0% Final result: ✅ View report in BundleMon website ➡️ |
@@ -18,8 +18,14 @@ runs: | |||
key: ${{ runner.os }}-blade-${{ hashFiles('**/yarn.lock') }} | |||
|
|||
# cache miss - install packages with `yarn --frozen-lockfile` | |||
# cache hit - download packages from the cache | |||
# cache hit - download packages from the cache and explicitly run postinstall script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this something newly changed or github is just showing the old diff?
const files = entries.filter((file) => !file.isDirectory()).map((file) => path.join(dirPath, file.name)); | ||
const folders = entries.filter((folder) => folder.isDirectory()); | ||
for (const folder of folders) | ||
+ if (folder.name !== 'node_modules') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats with bundlemon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -0,0 +1,12 @@ | |||
diff --git a/node_modules/bundlemon/lib/main/analyzer/pathUtils.js b/node_modules/bundlemon/lib/main/analyzer/pathUtils.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raise an issue on bundlemon?
* chore: upgrde jest to v29 * fix: create react-native-reanimated patch * fix: tests * chore: fix react-native issues * test: fix react native tests * chore: fix react native tests * test: fix ProgressBar test cases * test: update snapshots * test: fix styles in snapshots * ci: enable jest sharding * test: update Tooltip snapshot * test: update Tooltip snapshot * Update .github/workflows/blade-validate.yml * chore: update snaps * chore: patch bundlemon * ci: apply patches when cache-hit * ci: apply patches when cache-hit
Dependency Changes
@testing-library/react-hooks
tov8
@testing-library/react-native
tov12.1.3
babel-jest
,jest
, andjest-environment-jsdom
tov29.6.1
jest-axe
to v8jest-styled-components
tov7.1.1
react-native-reanimated
tov2.14.4
, for compatibility with Jest v28+Jest Config Changes
Configured
defaultIncludeHiddenElements: true
for@testing-library/react-native
to keep the old behavior. Since v12, all queries exclude elements hidden from accessibility by default.Added
--forceExit
to thetest:react
andtest:react-native
.These scripts without
--forceexit
now fail on CI when Jest doesn't; shut down cleanly (Existing behavior, for example BottomSheet tests)Ideally, we should detect the cause and refactor the corresponding tests, which can be tackled as a separate issue.
Added workaround for
jest-styled-components
snapshot serializer.Source Code Changes
makeAccessible.native.ts
util, explicitly addaccessible={true}
prop as well along with other accessibility props.*ByRole
queries now return only accessibility elements, either explicitly marked withaccessible
prop or implicit ones where this status is derived from component type itself (e.gText
,TextInput
,Switch
, but notView
).Test Changes
In Jest v28, Fake timers were refactored to allow passing options..
Added
legacyFakeTimers: true
in tests which were breaking to use the old fake timers implementation instead of one backed by@sinonjs/fake-timers
. The default isfalse
.getByA11yValue
is deprecated, refactoredProgressBar.native.test.tsx
to useexpect(progressbar).toHaveAccessibilityValue({})
getAllByA11yRole
,getByA11yLabel
aliases were removed in favor ofgetAllByRole
,getByLabelText
respectively.Snapshot Changes
{escapeString: false, printBasicPrototype: false}
. This makes snapshots both more readable and more copy-pasteable.GitHub Action Changes