test: Mock spinner#1418
Conversation
📦 Bundle Stats —
|
| Metric | Value | vs main (01d2f80) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 1.0 KB | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 868ms | +5ms, +0.6% |
bin:sanity
| Metric | Value | vs main (01d2f80) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 2.21s | +4ms, +0.2% |
🗺️ 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 (01d2f80d)
| Metric | Value | vs main (01d2f80) |
|---|---|---|
| Internal (raw) | 106.7 KB | - |
| Internal (gzip) | 26.7 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 765ms | -7ms, -0.9% |
🗺️ 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 (01d2f80d)
| Metric | Value | vs main (01d2f80) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| 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.
Coverage DeltaNo covered files changed in this PR. Overall Coverage
|
runeb
left a comment
There was a problem hiding this comment.
@snocorp Looks good, just a question. I see this is in integration tests. We do want to catch issues with spinners and for example non-interactive users like agents. Will we still be able to ensure progress indication doesnt break any of the flows we care about?
Good question. I think this generally makes it easier to verify the spinner is used as expected. I suppose it's possible that a new version of the spinner could break something so we shouldn't mock all the places we use it. In many existing test cases the output would get swallowed by the output capture that happens when you use testCommand and we can assert the output there so that should cover enough to be safe. |
Description
Mock spinner allows tests to avoid sending output to stderr.
Testing
Fixed the bootstrapLocalTemplate tests and added some assertions as an example.
Note
Low Risk
Test-only and test-helper changes with no production runtime behavior.
Overview
Adds
createMockSpinnerto@sanity/cli-test: a Vitest mock factory for@sanity/cli-core/ux’sspinnerthat returns a fullSpinnerInstancestub (with optional overrides) so CLI tests avoid real terminal output.bootstrapLocalTemplateintegration tests now mockspinnerfrom@sanity/cli-core/uxvia that helper, dynamically import the module under test after mocks are registered, and drop the oldoutput.spinner/print/clearstubs on the fakeOutput. Tests assert spinner usage (e.g. initial message, threestart/succeedcycles per bootstrap).@sanity/cli-testtsconfig gains a@sanity/cli-core/*path alias so the new helper can importSpinnerInstancefrom the ux subpath.Reviewed by Cursor Bugbot for commit 064a258. Bugbot is set up for automated code reviews on this repo. Configure here.