This codemod automatically updates your package.json to prepare for React Native Testing Library v14 migration.
- Removes
@types/react-test-rendererandreact-test-renderer(no longer needed) - Moves
@testing-library/react-nativetodevDependenciesif it's independencies - Updates
@testing-library/react-nativeto^14.0.0-beta.0 - Adds
test-renderer@0.16.0todevDependencies
# Run the codemod
npx codemod@latest run rntl-v14-update-deps --target ./path/to/your/projectBefore:
{
"dependencies": {
"@testing-library/react-native": "^13.0.0"
},
"devDependencies": {
"@types/react-test-renderer": "^18.0.0",
"react-test-renderer": "^18.0.0"
}
}After:
{
"devDependencies": {
"@testing-library/react-native": "^14.0.0-beta.0",
"test-renderer": "0.16.0"
}
}- After running the codemod, you must run your package manager to install dependencies:
npm install # or yarn install / pnpm install - The codemod sets the version to
^14.0.0-beta.0. You can manually update this if needed. - For monorepos, the codemod processes each
package.jsonfile individually.
- Run this codemod to update dependencies
- Run
npm install(or your package manager) to install the new dependencies - Run the async-functions codemod to update your test code:
npx codemod@latest run rntl-v14-async-functions --target ./path/to/your/tests
- Review and test your changes