Capítulo 437 de 456
Next.js provides an end-to-end test harness for validating deployment adapters, driven by three custom scripts (deploy, logs, cleanup) invoked from a GitHub Actions workflow against a real (or local) deployment.
NEXT_TEST_DEPLOY_SCRIPT_PATH: executable that builds and deploys the isolated test app; must print the deployment URL to stdout (nothing else) and exit non-zero on failure.NEXT_TEST_DEPLOY_LOGS_SCRIPT_PATH: executable returning build/runtime logs; output must include lines starting with BUILD_ID:, DEPLOYMENT_ID:, NEXT_SUPPORTS_IMMUTABLE_ASSETS:.NEXT_TEST_CLEANUP_SCRIPT_PATH: optional executable to tear down the deployment after tests.NEXT_TEST_DIR, NEXT_TEST_DEPLOY_URL.node run-tests.js --timings -g <group> -c 2 --type e2e with NEXT_TEST_MODE: deploy and NEXT_EXTERNAL_TESTS_FILTERS: test/deploy-tests-manifest.json.#!/usr/bin/env bash
set -euo pipefail
export NEXT_ADAPTER_PATH="${ADAPTER_DIR}/dist/index.js"
pnpm build
BUILD_ID="$(cat .next/BUILD_ID)"
DEPLOYMENT_ID="my-adapter-local"
NEXT_SUPPORTS_IMMUTABLE_ASSETS="0"
{
echo "BUILD_ID: $BUILD_ID"
echo "DEPLOYMENT_ID: $DEPLOYMENT_ID"
echo "NEXT_SUPPORTS_IMMUTABLE_ASSETS: $NEXT_SUPPORTS_IMMUTABLE_ASSETS"
} >> .adapter-build.log
provider-cli-to-deploy
# echo "http://127.0.0.1:3000"
NEXT_ADAPTER_PATH, persiste metadata em arquivo (porque deploy/logs rodam em processos separados), e imprime só a URL no stdout.#!/usr/bin/env bash
set -euo pipefail
if [ -f ".adapter-build.log" ]; then cat ".adapter-build.log"; fi
if [ -f ".adapter-server.log" ]; then echo "=== .adapter-server.log ==="; cat ".adapter-server.log"; fi
stdout do script de deploy: quebra a extração da URL pelo harness.1/16 até 16/16).NEXT_ADAPTER_PATH apontando pro build do próprio adapter (file: dependency).NEXT_ADAPTER_PATH é o mesmo mecanismo usado no script de deploy de teste.