Skip to content

Commit

Permalink
next-upgrade: Add testfixtures (vercel#71377)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Oct 16, 2024
1 parent 1a88624 commit 47e346c
Show file tree
Hide file tree
Showing 22 changed files with 92 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-18-installed-mixed-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.44",
"react": "18.2.0",
"react-dom": "18.2.0"
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-18-installed-pure-app-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.44",
"react": "18.2.0",
"react-dom": "18.2.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-18-installed-pure-pages-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.44",
"react": "18.2.0",
"react-dom": "18.2.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-19-installed-mixed-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.45",
"react": "19.0.0-beta-4508873393-20240430",
"react-dom": "19.0.0-beta-4508873393-20240430"
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-19-installed-pure-app-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.45",
"react": "19.0.0-beta-4508873393-20240430",
"react-dom": "19.0.0-beta-4508873393-20240430"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrades React without prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "react-19-installed-pure-pages-router",
"scripts": {
"dev": "next dev"
},
"dependencies": {
"next": "14.3.0-canary.45",
"react": "19.0.0-beta-4508873393-20240430",
"react-dom": "19.0.0-beta-4508873393-20240430"
}
}
3 changes: 2 additions & 1 deletion packages/next-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"build": "pnpm tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build",
"dev": "pnpm tsc -d -w -p tsconfig.json",
"test": "jest"
"test": "jest",
"test:upgrade-fixture": "./scripts/test-upgrade-fixture.sh"
},
"bin": "./bin/next-codemod.js",
"devDependencies": {
Expand Down
18 changes: 18 additions & 0 deletions packages/next-codemod/scripts/test-upgrade-fixture.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Simple test runner for upgrade fixtures.
# For manual verification only (check the README.md) in the fixtures
# for the expected behavior.
# Usage:
# - cwd must be ~/packages/next-codemod
# - `pnpm test:upgrade-fixture <fixture-name> <...next-codemod-args>`

NEXT_CODEMOD_BIN=$(pwd)/bin/next-codemod.js
cd "$1" || exit 1
# We're only interested in the changes the upgrade command does.
git add -A .
rm -rf node_modules
pnpm install --ignore-workspace --no-lockfile
node "$NEXT_CODEMOD_BIN" upgrade "${@:2}"
git --no-pager diff .
git restore .
git reset HEAD -- .

0 comments on commit 47e346c

Please sign in to comment.