Repository navigation
Add typed JSON output to app config use - #8605
gonzaloriestra wants to merge 4 commits into
Conversation
|
/snapit |
314bffc to
00a224f
Compare
|
/snapit |
00a224f to
ee1080d
Compare
ee1080d to
bf51c40
Compare
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/node/context/local.d.ts@@ -11,6 +11,12 @@ export declare function isTerminalInteractive(): boolean;
* @returns The path to the user's home directory.
*/
export declare function homeDirectory(): string;
+/**
+ * Clears the memoized result of isUnitTest so the environment variable is re-read.
+ *
+ * Only intended for test helpers that temporarily toggle unit-test detection.
+ */
+export declare function resetMemoizedIsUnitTest(): void;
/**
* Returns true if the CLI is running in debug mode.
*
packages/cli-kit/dist/public/node/testing/output.d.ts@@ -8,6 +8,36 @@ interface OutputMock {
error: () => string;
clear: () => void;
}
+interface StandardStreamsMock {
+ stdout: () => string;
+ stderr: () => string;
+ restore: () => void;
+}
+export interface CapturedStandardStreams {
+ stdout: () => string;
+ stderr: () => string;
+}
+/**
+ * Runs a callback with process stdout/stderr captured and unit-test output suppression disabled,
+ * so tests can assert on what a command actually writes to the standard streams.
+ *
+ * The callback receives accessors instead of the function returning captured output so that
+ * assertions remain possible when the callback throws (for example commands that abort).
+ * Streams, console.warn and unit-test detection are restored afterwards.
+ * Not safe for concurrent tests.
+ *
+ * @param run - Callback receiving accessors for the captured stdout and stderr.
+ * @returns The value returned by the callback.
+ */
+export declare function withCapturedStandardStreams<T>(run: (streams: CapturedStandardStreams) => T | Promise<T>): Promise<T>;
+/**
+ * Captures writes to stdout and stderr, including console warnings intercepted by Vitest.
+ * Call restore in a finally block. This replaces process globals and must not be used in concurrent tests.
+ * Prefer withCapturedStandardStreams, which also disables unit-test output suppression while it runs.
+ *
+ * @returns Captured output and a function to restore the original writers.
+ */
+export declare function mockAndCaptureStandardStreams(): StandardStreamsMock;
/**
* Returns a set of functions to get the outputs ocurred during a test run.
*
|
bf51c40 to
7788bda
Compare
7788bda to
8f75366
Compare
|
/snapit |
8f75366 to
a563510
Compare
a563510 to
24893dd
Compare
24893dd to
9c76db9
Compare
9c76db9 to
df255ee
Compare
df255ee to
6046f0a
Compare
|
/snapit |
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Built from Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20261008125208Caution After installing, validate the version by running |
6046f0a to
17c1408
Compare
|
| Changeset | Package |
|---|---|
typed-app-config-validate.md |
'@shopify/cli': major |
WHY are these changes introduced?
Related to https://github.com/shop/issues-develop/issues/23665
Selecting or clearing an app configuration needs a machine-readable result.
WHAT is this pull request doing?
Add JSON output with status, changed, the absolute preferred path, and clientId. Reset returns null for path and clientId; changed distinguishes successful no-ops. Preserve shared selection callers and text presentation.
How to manually test your changes?
Checklist