The Wire · Showcase
CLI INFRASTRUCTURE GETS SYSTEMATIC TEST OVERHAUL, HYDROGEN DEPLOY ERRORS NOW ACTUALLY HELPFUL
By RepoJournal · Filed · About Shopify
Shopify's CLI team is ripping out filesystem mocks across the test suite while simultaneously fixing a critical deploy experience bug where error messages lose their actionable guidance.
The CLI codebase is undergoing a disciplined testing cleanup that will make your test suite more reliable and maintainable. Three separate PRs [1] [2] [3] are systematically replacing manual filesystem mocks with real temporary directories in app initialization, bundle, and file-watcher tests. This follows the testing standards now codified in the team's automated-tasks guidelines and should eliminate entire categories of false positives that plague filesystem-heavy test suites. Meanwhile, the deployment experience just got significantly better. When `h2 deploy` fails because your project is missing the vite dependency, [4] you'll now see the actual error message that tells you to run `npm install` instead of a generic "Build function failed" message that leaves you guessing. The oxygen-cli wrapper was dropping the AbortError's actionable next steps, making a straightforward dependency problem feel like a mysterious black box. This matters because deploy failures are already stressful; losing the error's diagnostic value makes them worse. On the broader CLI side, [5] the deploy consumers are getting a cleaner API by speaking app-module UUID maps directly instead of carrying around the full Identifiers object with its undefined dev-dashboard plumbing. Finally, [6] the array utility functions in cli-kit now have proper test coverage with tests for `takeRandomFromArray`, `getArrayRejectingUndefined`, and related functions.
Action items
- → Review and apply filesystem mock removal pattern to your own test files Shopify/cli [plan]
- → Test `h2 deploy` with missing dependencies to confirm error messages are now actionable Shopify/hydrogen [monitor]
- → Update deploy consumer code to use new UUID/registration-ID map pattern Shopify/cli [plan]
References
- [1] Merge pull request #7852 from Shopify/tests-remove-fs-mock-init-9629675890244724247 Shopify/cli
- [2] Merge pull request #7878 from Shopify/tests-remove-fs-mock-bundle-extension-7849776053424436107 Shopify/cli
- [3] [Tests] Replace filesystem mocks in file-watcher.test.ts ↗ Shopify/cli
- [4] Preserve actionable build errors during h2 deploy (#3848) Shopify/hydrogen
- [5] Make deploy consumers speak app-module UUID/registration-ID maps Shopify/cli
- [6] [Tests] Cover array utility functions ↗ Shopify/cli