Skip to content

Commit ccda8fd

Browse files
binoy14claude
andauthored
test(cli-e2e): pack @sanity/cli-core alongside cli and create-sanity (#1040)
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) <noreply@anthropic.com>
1 parent 3ee8a17 commit ccda8fd

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/@sanity/cli-e2e/globalSetup.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ export async function setup(project: TestProject): Promise<void> {
2525
)
2626
}
2727
} else {
28+
console.log('Packing @sanity/cli-core...')
29+
const cliCoreTarball = packPackage('@sanity/cli-core')
30+
2831
console.log('Packing @sanity/cli...')
2932
const cliTarball = packCli()
3033

3134
console.log('Packing create-sanity...')
3235
const createSanityTarball = packPackage('create-sanity')
33-
tarballPaths = [cliTarball, createSanityTarball]
36+
tarballPaths = [cliCoreTarball, cliTarball, createSanityTarball]
3437

3538
const tmpDir = mkdtempSync(join(tmpdir(), 'cli-e2e-'))
3639
cleanupDir = tmpDir
3740

3841
console.log(`Installing tarballs into ${tmpDir}...`)
39-
const binaryPath = installFromTarball([cliTarball, createSanityTarball], tmpDir, 'sanity')
42+
const binaryPath = installFromTarball(
43+
[cliCoreTarball, cliTarball, createSanityTarball],
44+
tmpDir,
45+
'sanity',
46+
)
4047

4148
process.env.E2E_BINARY_PATH = binaryPath
4249
console.log(`E2E_BINARY_PATH set to ${binaryPath}`)

0 commit comments

Comments
 (0)