Unverified Commit 76bed42c authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

test: Really use pnpm on deploy tests (#95360)

We already set `package.json#packageManager`

<img width="539" height="388" alt="Bildschirmfoto 2026-07-01 um 16 26
30"
src="https://github.com/user-attachments/assets/8f6f3e8f-60a6-484d-ac57-f8dc261f8b85"
/>

But the Vercel deployment tests still used npm to install dependencies
because you need to set `ENABLE_EXPERIMENTAL_COREPACK` so that
`packageManager` applies.

pnpm should be hopefully faster, and also improves consistency across
the test environments

Full deploy test run:
~~https://github.com/vercel/next.js/actions/runs/28528683809~~
~~https://github.com/vercel/next.js/actions/runs/28531873334~~
~~https://github.com/vercel/next.js/actions/runs/28542029071~~
~~https://github.com/vercel/next.js/actions/runs/29311003094~~
~~https://github.com/vercel/next.js/actions/runs/32731722428~~
~~https://github.com/vercel/next.js/actions/runs/37841713568~~
https://github.com/vercel/next.js/actions/runs/37900216932
parent a9f0a668
......@@ -3,12 +3,6 @@ import { nextTestSetup } from 'e2e-utils'
describe('next-dist-client-esm-import', () => {
const dependencies = require('./package.json').dependencies
if ((global as any).isNextDeploy) {
// The `link:` protocol is incompatible with the npm version that's used
// when this test is deployed, so we use `file:` instead.
dependencies['@monorepo/adapter-next'] = 'file:./adapter-next'
}
const { next } = nextTestSetup({
files: __dirname,
dependencies,
......
......@@ -57,9 +57,9 @@ function getBuildError(cliOutput: string): string {
.replace(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z {2}/, '')
.trim()
// The command exit status is not compiler output.
// Package-manager and Vercel command failures are not compiler output.
if (
/^Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$/.test(
/^(?:ELIFECYCLE\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test(
line
)
) {
......
......@@ -181,11 +181,11 @@ function getBuildOutput(cliOutput: string, isNextDeploy: boolean): string {
let skipLines = true
for (const line of cliOutput.split('\n')) {
// The command exit status and inspect metadata are not compiler output.
// Package-manager command failures and inspect metadata are not compiler output.
if (
isNextDeploy &&
/^Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$/.test(
line
/^(?:ELIFECYCLE\s|Error: (?:\[BUILD_UTILS_SPAWN_\d+\] )?Command .* exited with \d+$)/.test(
stripAnsi(line).trim()
)
) {
break
......
import { nextTestSetup } from 'e2e-utils'
describe('react version', () => {
const dependencies = (global as any).isNextDeploy
? // `link` is incompatible with the npm version used when this test is deployed
{
'library-with-exports': 'file:./library-with-exports',
}
: {
'library-with-exports': 'link:./library-with-exports',
}
const { next } = nextTestSetup({
files: __dirname,
dependencies,
dependencies: {
'library-with-exports': 'link:./library-with-exports',
},
})
it('Pages Router page headers with edge runtime', async () => {
......
......@@ -565,7 +565,7 @@ export class NextInstance {
path.join(this.testDir, 'vercel.json'),
JSON.stringify({
installCommand:
'mv node_modules node_modules.bak && npm i && cp -r node_modules.bak/* node_modules',
'mv node_modules node_modules.bak && pnpm i && cp -r node_modules.bak/* node_modules',
})
)
......
......@@ -467,6 +467,9 @@ export class NextDeployInstance extends NextInstance {
`VERCEL_CLI_VERSION=${process.env.VERCEL_CLI_VERSION || 'vercel@latest'}`
)
// So that our `package.json#packageManager` field is respected when building on Vercel
additionalEnv.push(`ENABLE_EXPERIMENTAL_COREPACK=1`)
// Route the build to a named hive, and to a specific build-container image.
// The dispatcher reads the image version only for a build on a forced hive.
// A version without a hive falls back to the default image and reports no
......
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