-
Notifications
You must be signed in to change notification settings - Fork 11
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(dependencies): upgrade dependencies #1147
Conversation
Size stats
|
Accessibility report ℹ️ You can run this locally by executing |
Deploy preview for mistica-web ready! ✅ Preview Built with commit e87fc41. |
@@ -10,8 +11,8 @@ module.exports = { | |||
'!**/__*__/**', // ignore tests, acceptance, stories, etc | |||
], | |||
transform: { | |||
'\\.css\\.ts$': '@vanilla-extract/jest-transform', | |||
'^.+\\.(t|j)sx?$': ['@swc/jest', {...swcConfig, sourceMaps: 'inline'}], | |||
'\\.css\\.ts$': ['@vanilla-extract/jest-transform', swcTransform], |
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.
For some reason, the swc transform is now required in the css.ts
files.
It makes sense but I'm not sure why this was working before.
setupFilesAfterEnv: [require.resolve('./setup-test-env.tsx'), '@testing-library/jest-dom/extend-expect'], | ||
setupFilesAfterEnv: ['<rootDir>/setup-test-env.tsx'], |
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.
the setup-test-env
now imports the jest-dom module
https://github.com/testing-library/jest-dom?tab=readme-ov-file#usage
src/__tests__/dialog-test.tsx
Outdated
await userEvent.click(screen.getByTestId('dialog-overlay')); | ||
userEvent.click(screen.getByTestId('dialog-overlay')); | ||
|
||
await waitForElementToBeRemoved(() => screen.queryByRole('dialog', {hidden: 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.
If I wait for the click, the test fails because waitForElementToBeRemoved
says that the element was already removed.
You can see this fix in several other tests
expect(screen.getByText('banana').parentElement).toBeChecked(); | ||
expect(screen.getByText('apple').parentElement).not.toBeChecked(); | ||
expect(screen.getByRole('radio', {name: 'banana'})).toBeChecked(); | ||
expect(screen.getByRole('radio', {name: 'apple'})).not.toBeChecked(); |
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.
the updated eslint rules forbids direct access to RTL elements
await userEvent.click(closeButton); | ||
await waitForElementToBeRemoved(sheet); | ||
}, 30000); | ||
await act(() => userEvent.click(closeButton)); |
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.
🤷♂️
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.
why? afaik RTL already wraps these click events with act internally
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.
I'm not sure. Even if the click triggers an async state update, it should be wrapped by the waitForElementToBeRemoved. But without this I was getting missing act errors.
// @ts-expect-error Chip only accepts string children | ||
<Chip> | ||
{/* @ts-expect-error Chip only accepts string children */} | ||
<div>hello</div> | ||
</Chip>; |
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 is curious, if I remove the @ts-expect-error
the reported issue is:
This JSX tag's
children
prop expects typestring
which requires multiple children,
but only a single child was provided.
It works as expected (it only accepts a single string
child), but I find the error description misleading
"target": "es2019", // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. , | ||
"target": "es2021", // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. , |
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.
required to use String.prototype.replaceAll
(it is being used in some test)
{bulletsProps.numPages > 1 && <PageBullets {...bulletsProps} />} | ||
{(bulletsProps.numPages as number) > 1 && ( | ||
<PageBullets {...bulletsProps} /> | ||
)} |
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.
TS v5 now detects (correctly) this as an error, because the type of bulletProps.numPages
is:
number | ByBreakpoint<number>
await userEvent.click(closeButton); | ||
await waitForElementToBeRemoved(sheet); | ||
}, 30000); | ||
await act(() => userEvent.click(closeButton)); |
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.
why? afaik RTL already wraps these click events with act internally
yarn.lock
Outdated
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.
please, run a yarn dedupe
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.
done
src/__tests__/dialog-test.tsx
Outdated
@@ -158,9 +158,9 @@ test('Closes a dialog on click outside', async () => { | |||
expect(await screen.findByRole('dialog')).toBeInTheDocument(); | |||
expect(await screen.findByRole('button', {name: 'Nope!'})).toBeInTheDocument(); | |||
|
|||
await userEvent.click(screen.getByTestId('dialog-overlay')); | |||
userEvent.click(screen.getByTestId('dialog-overlay')); |
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.
why this? afaik, userEvent.click()
returns a promise: https://testing-library.com/docs/user-event/convenience#click
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.
If I wait for the click action to finish, the dialog element is removed too early and the following waitForElementToBeRemoved
fails because the element must exist to wait for removal.
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.
thx 🫶
🎉 This PR is included in version 15.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Upgraded: