-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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: update test deps #1782
chore: update test deps #1782
Conversation
"@types/react": "^18.2.52", | ||
"@vitest/coverage-v8": "^1.2.2", | ||
"@testing-library/jest-dom": "^6.4.8", | ||
"@testing-library/react": "^12.1.5", |
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.
@testing-library/react v13 drop support for react v17 and below so can't upgrade further unless this project also projects support for react v16.
"babel-plugin-macros": "^2.8.0", | ||
"babel-plugin-tester": "^6.5.0", | ||
"babel-plugin-macros": "^3.1.0", | ||
"babel-plugin-tester": "^7.0.4", |
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.
Updating babel-plugin-preset produces a lot of snapshot changes because of how it formats them so it's best done in a separate PR.
"@testing-library/jest-dom": "^6.4.8", | ||
"@testing-library/react": "^12.1.5", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@types/jest": "^29.5.12", |
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.
@testing-library/jest-dom v6 no longer has @types/jest as its dependency so we need to import it explicitly now.
import { expect } from 'vitest'; | ||
|
||
expect.extend(matchers); | ||
import '@testing-library/jest-dom/vitest'; |
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.
test/typescript/misc/Trans.test.tsx
Outdated
@@ -126,7 +126,6 @@ describe('<Trans />', () => { | |||
it('should not work with object child', () => { | |||
assertType<React.ReactElement>( | |||
<Trans> | |||
{/* @ts-expect-error */} |
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.
No longer necessary after downgrading @types/react to v16.
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 assertion is necessary since the test checks that an error is thrown when there are object inside child computations and allowObjectInHTMLChildren
is disabled.
Check the line below:
<span>This {{ var: '' }} is an error since `allowObjectInHTMLChildren` is disabled</span>
Probably that wasn't an issue with old react types.
This is another reason to update react
version rather than downgrading @types/react
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.
Reverted the @types/react
downgrade since we decided to upgrade react instead.
package.json
Outdated
"@testing-library/react": "^12.1.5", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@types/jest": "^29.5.12", | ||
"@types/react": "^16.14.60", |
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.
Downgrade @types/react to v16 was necessary because of @testing-library/react-hooks v8. Regardless, it makes sense to use v16 instead of v18 because that's this repo is using react v16 to test.
@@ -116,7 +117,7 @@ | |||
"rimraf": "^6.0.1", | |||
"rollup": "^4.20.0", | |||
"typescript": "~5.5.4", | |||
"vitest": "1.2.2", | |||
"vitest": "^2.0.5", |
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.
vitest v2 (changelog) enables coverage.ignoreEmptyLines
by default so coverage is expected to drop slightly in some files
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.
IMHO I think it would be better if react
and @types/react
have a more recent version, I would go with v18
.
This means that we can use more recent version of other test dependencies, as stated in @ripecosta's comments.
What do you think @adrai?
Yes, we can update to v18 |
Sounds good @adrai @marcalexiei. In that case for this PR I'll keep @testing-library/react-hooks at v7 so we can upgrade react in it's own PR. I will require releasing a new major version too so it's another reason to keep it separate. |
Report too large to display inline |
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Next stepsWhat is an install script?Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts. Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead. Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
### Description
Update all test related dependencies possible at this stage. See comments for more info.
Checklist
npm run test