Unverified Commit 47e346c9 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

next-upgrade: Add testfixtures (#71377)

parent 1a88624f
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
{
"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"
}
}
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
"build": "pnpm tsc -d -p tsconfig.json", "build": "pnpm tsc -d -p tsconfig.json",
"prepublishOnly": "cd ../../ && turbo run build", "prepublishOnly": "cd ../../ && turbo run build",
"dev": "pnpm tsc -d -w -p tsconfig.json", "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", "bin": "./bin/next-codemod.js",
"devDependencies": { "devDependencies": {
......
#!/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 -- .
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment