From 5acb0f90f4846d2f05d98dafdc2fd1959ac87c5d Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Fri, 1 May 2026 14:26:01 -0400 Subject: [PATCH] test(cli-e2e): pack @sanity/cli-core alongside cli and create-sanity Without this, npm install resolves the @sanity/cli-core dependency of the packed @sanity/cli from the npm registry, so e2e tests run against the published version of cli-core instead of the local source. This causes spurious failures whenever @sanity/cli starts using new exports from cli-core that aren't yet published. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/@sanity/cli-e2e/globalSetup.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/@sanity/cli-e2e/globalSetup.ts b/packages/@sanity/cli-e2e/globalSetup.ts index 303f42cd6..9782fb919 100644 --- a/packages/@sanity/cli-e2e/globalSetup.ts +++ b/packages/@sanity/cli-e2e/globalSetup.ts @@ -25,18 +25,25 @@ export async function setup(project: TestProject): Promise { ) } } else { + console.log('Packing @sanity/cli-core...') + const cliCoreTarball = packPackage('@sanity/cli-core') + console.log('Packing @sanity/cli...') const cliTarball = packCli() console.log('Packing create-sanity...') const createSanityTarball = packPackage('create-sanity') - tarballPaths = [cliTarball, createSanityTarball] + tarballPaths = [cliCoreTarball, cliTarball, createSanityTarball] const tmpDir = mkdtempSync(join(tmpdir(), 'cli-e2e-')) cleanupDir = tmpDir console.log(`Installing tarballs into ${tmpDir}...`) - const binaryPath = installFromTarball([cliTarball, createSanityTarball], tmpDir, 'sanity') + const binaryPath = installFromTarball( + [cliCoreTarball, cliTarball, createSanityTarball], + tmpDir, + 'sanity', + ) process.env.E2E_BINARY_PATH = binaryPath console.log(`E2E_BINARY_PATH set to ${binaryPath}`)