test(cli-e2e): pack @sanity/cli-core alongside cli and create-sanity#1040
Merged
test(cli-e2e): pack @sanity/cli-core alongside cli and create-sanity#1040
Conversation
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>
|
Claude finished @binoy14's task in 1m 4s —— View job Review
No issues. The fix is correct:
|
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (09a30e2) |
|---|---|---|
| Internal (raw) | 2.1 KB | - |
| Internal (gzip) | 799 B | - |
| Bundled (raw) | 10.94 MB | - |
| Bundled (gzip) | 2.05 MB | - |
| Import time | 846ms | +15ms, +1.8% |
bin:sanity
| Metric | Value | vs main (09a30e2) |
|---|---|---|
| Internal (raw) | 975 B | - |
| Internal (gzip) | 460 B | - |
| Bundled (raw) | 9.84 MB | - |
| Bundled (gzip) | 1.77 MB | - |
| Import time | 2.01s | +33ms, +1.6% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (09a30e25)
| Metric | Value | vs main (09a30e2) |
|---|---|---|
| Internal (raw) | 93.1 KB | - |
| Internal (gzip) | 21.9 KB | - |
| Bundled (raw) | 21.62 MB | - |
| Bundled (gzip) | 3.42 MB | - |
| Import time | 794ms | +3ms, +0.4% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (09a30e25)
| Metric | Value | vs main (09a30e2) |
|---|---|---|
| Internal (raw) | 976 B | - |
| Internal (gzip) | 507 B | - |
| Bundled (raw) | 50.7 KB | - |
| Bundled (gzip) | 12.6 KB | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
Contributor
Coverage DeltaNo covered files changed in this PR. Overall Coverage
|
cngonzalez
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
E2E tests pack
@sanity/cliandcreate-sanityandnpm installthe resulting tarballs. The@sanity/cli-coredependency (declared asworkspace:^in source) is rewritten to a regular semver range during pack, so npm resolves it from the registry — not from local source. As a result, e2e tests run against the published@sanity/cli-core, not the version in this repo.This caused the e2e failures on #1011: that branch added
stdoutanderrorsexports to@sanity/cli-core/uxand started importing them from@sanity/cli, but the published@sanity/cli-core@1.3.1doesn't have those exports yet, so every init test crashed withSyntaxError: The requested module '@sanity/cli-core/ux' does not provide an export named 'stdout'.This PR packs
@sanity/cli-coretoo and includes it in thenpm installinvocation. npm resolves the workspace dep to the local tarball (verified via the resultingpackage-lock.json:"resolved": "file:..."), so e2e tests now exercise the local source of cli-core.What to review
packages/@sanity/cli-e2e/globalSetup.ts— adds a thirdpnpm packfor@sanity/cli-coreand includes the tarball ininstallFromTarball.Testing
npm installagainst them in a temp dir, and confirmedpackage-lock.jsonresolves@sanity/cli-corefrom the local tarball rather than the registry.pnpm --filter @sanity/cli-e2e check:typesandpnpm --filter @sanity/cli-e2e lintpass.🤖 Generated with Claude Code
Note
Low Risk
Low risk: test setup-only change that just alters which local tarballs are packed/installed before running E2E tests.
Overview
E2E test global setup now also packs
@sanity/cli-coreand includes its tarball in the temp-directorynpm installalongside@sanity/cliandcreate-sanity.This ensures E2E runs resolve the
@sanity/cli-coreworkspace dependency from the locally packed artifact rather than the npm registry, and updates cleanup bookkeeping to remove the additional tarball.Reviewed by Cursor Bugbot for commit 5acb0f9. Bugbot is set up for automated code reviews on this repo. Configure here.