From 8e062c606f2fc089d5c125a82f693602030ae70b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Oct 2026 00:41:46 +0000 Subject: [PATCH] [Tests] Cover the language server skip in theme metafields pull The not-a-theme skip is the only JSON outcome of `theme metafields pull` with no test. Asserts the command emits {status, reason}, validates it against the published schema, and confirms nothing is fetched or written. Co-Authored-By: Claude Opus 4.8 --- .../commands/theme/metafields/pull.test.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/theme/src/cli/commands/theme/metafields/pull.test.ts b/packages/theme/src/cli/commands/theme/metafields/pull.test.ts index afbc6c659a0..a56677838a8 100644 --- a/packages/theme/src/cli/commands/theme/metafields/pull.test.ts +++ b/packages/theme/src/cli/commands/theme/metafields/pull.test.ts @@ -163,6 +163,26 @@ test('reports cancellation without fetching or writing definitions', async () => }) }) +test('reports the language server skip without fetching or writing definitions', async () => { + vi.stubEnv('SHOPIFY_LANGUAGE_SERVER', '1') + try { + await inTemporaryDirectory(async (directory) => { + await withCapturedStandardStreams(async ({stdout, stderr}) => { + await expect(run(directory)).resolves.toBe(0) + const result = JSON.parse(stdout()) + expect(result).toEqual({status: 'skipped', reason: 'not-a-theme'}) + expect(themeMetafieldsPullJsonOutputSchema.validate(result)).toEqual(result) + expect(stderr()).toBe('') + expect(ensureDirectoryConfirmed).not.toHaveBeenCalled() + expect(metafieldDefinitionsByOwnerType).not.toHaveBeenCalled() + }) + await expect(fileExists(joinPath(directory, '.shopify/metafields.json'))).resolves.toBe(false) + }) + } finally { + vi.unstubAllEnvs() + } +}) + test('does not emit a result when writing the downloaded file fails', async () => { vi.mocked(metafieldDefinitionsByOwnerType).mockResolvedValue([]) await inTemporaryDirectory(async (directory) => {