8000
Skip to content

test(cli-e2e): add create-sanity E2E tests and package manager validation#882

Draft
binoy14 wants to merge 1 commit intomainfrom
binoy14/sdk-1195-refactor-pack-cli
Draft

test(cli-e2e): add create-sanity E2E tests and package manager validation#882
binoy14 wants to merge 1 commit intomainfrom
binoy14/sdk-1195-refactor-pack-cli

Conversation

@binoy14
Copy link
Copy Markdown
Contributor
@binoy14 binoy14 commented Apr 3, 2026

Summary

  • Generalize packCli() into packPackage(name) so any workspace package can be packed for E2E testing
  • Extend globalSetup to pack and install create-sanity alongside @sanity/cli
  • Add binaryPath option to runCli() so tests can target any installed binary
  • Add E2E tests for create-sanity --help and --version
  • Add package manager integration tests that verify npm create sanity@<version>, pnpm create sanity@<version>, and yarn dlx create-sanity@<version> work correctly

Test plan

  • pnpm check:types --filter=@sanity/cli-e2e passes
  • pnpm lint passes for cli-e2e
  • create-sanity --help E2E test passes
  • create-sanity --version E2E test passes
  • Package manager tests pass (npm, pnpm, yarn)
  • Existing E2E tests (help.test.ts, datasetsList.test.ts) still pass

Closes SDK-1195

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Copy link
Copy Markdown
Contributor Author
binoy14 commented Apr 3, 2026

@claude
Copy link
Copy Markdown
claude bot commented Apr 3, 2026

Claude finished @binoy14's task in 1m 13s —— View job


Review

  • Read changed files
  • Check for changeset
  • Review code for issues

No changeset required — this is a tests-only/E2E infrastructure PR with no runtime behavior changes. Correct that none was added.


1. Missing --version test (createSanity.test.ts)

The PR description states "Add E2E tests for create-sanity --help and --version", and the test plan checklist includes a --version item, but only the --help test is present in __tests__/createSanity.test.ts. The --version test is missing.

Fix this →

2. getAvailablePackageManagers() called during describe callback in createSanityPackageManagers.test.ts

describe.skipIf(!version)('create-sanity via package managers', () => {
  const managers = getAvailablePackageManagers()  // runs execFileSync calls here

Vitest evaluates the describe callback during test collection even when skipIf is true, so execFileSync (for npm/pnpm/yarn version checks) runs on every test collection regardless of whether version is set. This is a minor concern — it's harmless in practice but adds latency and could cause confusing errors at collection time. Moving the getAvailablePackageManagers() call inside a beforeAll or guarding it more explicitly would be cleaner.

@github-actions
Copy link
Copy Markdown
Contributor
github-actions bot commented Apr 3, 2026

📦 Bundle Stats — @sanity/cli

Compared against main (052fecb8)

@sanity/cli

Metric Value vs main (052fecb)
Internal (raw) 2.1 KB -
Internal (gzip) 799 B -
Bundled (raw) 10.94 MB -
Bundled (gzip) 2.05 MB -
Import time 833ms +5ms, +0.6%

bin:sanity

Metric Value vs main (052fecb)
Internal (raw) 975 B -
Internal (gzip) 460 B -
Bundled (raw) 9.84 MB -
Bundled (gzip) 1.77 MB -
Import time 2.00s +14ms, +0.7%

🗺️ 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 (052fecb8)

Metric Value vs main (052fecb)
Internal (raw) 93.1 KB -
Internal (gzip) 21.9 KB -
Bundled (raw) 21.62 MB -
Bundled (gzip) 3.42 MB -
Import time 791ms +1ms, +0.1%

🗺️ 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 (052fecb8)

Metric Value vs main (052fecb)
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.

@binoy14 binoy14 changed the title refactor(cli-e2e): generalize packCli into packPackage and add binaryPath to runCli feat(cli-e2e): add create-sanity E2E tests and package manager validation Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor
github-actions bot commented Apr 3, 2026

Coverage Delta

No covered files changed in this PR.

Overall Coverage

Metric Coverage
Statements 83.1% (±0%)
Branches 73.3% (±0%)
Functions 83.0% (±0%)
Lines 83.6% (±0%)

@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from c518521 to f34b3cd Compare April 6, 2026 17:38
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from fd19674 to a3deeb0 Compare April 6, 2026 17:38
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from f34b3cd to 62ac2ba Compare April 6, 2026 20:27
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from a3deeb0 to 877efba Compare April 6, 2026 20:27
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from 62ac2ba to db4435a Compare April 6, 2026 21:29
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 877efba to 26ef7cf Compare April 6, 2026 21:29
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from db4435a to b3b94fe Compare April 7, 2026 17:46
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 26ef7cf to f243fac Compare April 7, 2026 17:46
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from f243fac to d5b0583 Compare April 7, 2026 21:54
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from b3b94fe to 62c844d Compare April 7, 2026 21:54
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from d5b0583 to ddf075b Compare April 7, 2026 22:28
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch 2 times, most recently from 5d35621 to ccd048e Compare April 8, 2026 20:40
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from ddf075b to 4be460e Compare April 8, 2026 20:40
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from ccd048e to c757807 Compare April 10, 2026 14:29
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 4be460e to 05e393f Compare April 10, 2026 14:29
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from c757807 to 65e519a Compare April 10, 2026 18:23
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 05e393f to 410dba8 Compare April 10, 2026 18:23
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from 65e519a to 03df826 Compare April 15, 2026 02:22
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch 2 times, most recently from c3d6b70 to c1128c1 Compare April 15, 2026 16:02
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from 03df826 to 4bd2b75 Compare April 15, 2026 16:02
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from c1128c1 to d74b2f2 Compare April 16, 2026 17:09
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch 2 times, most recently from 0fe1bf7 to c97d989 Compare April 16, 2026 17:51
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from d74b2f2 to 55da18a Compare April 16, 2026 17:51
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from 8b04e9a to 28b41c5 Compare April 16, 2026 18:54
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 55da18a to 8d3b3f3 Compare April 16, 2026 18:54
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from 5bf99ce to c2a1691 Compare April 16, 2026 18:59
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 8d3b3f3 to a511a4c Compare April 16, 2026 18:59
@binoy14 binoy14 force-pushed the binoy14/post-release-e2e branch from c2a1691 to cd46239 Compare April 16, 2026 19:15
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from a511a4c to 3dc48c9 Compare April 16, 2026 19:15
Base automatically changed from binoy14/post-release-e2e to main April 17, 2026 16:13
…tion

Generalize packCli into packPackage to support packing multiple packages,
add binaryPath option to runCli, and add E2E tests for create-sanity and
package manager detection/validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@binoy14 binoy14 force-pushed the binoy14/sdk-1195-refactor-pack-cli branch from 3dc48c9 to 43b2495 Compare April 17, 2026 16:37
@binoy14 binoy14 changed the title feat(cli-e2e): add create-sanity E2E tests and package manager validation test(cli-e2e): add create-sanity E2E tests and package manager validation Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0