From 0442d422134354ca8127d18f88d7d529cb9b2ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Rold=C3=A1n?= Date: Mon, 25 Nov 2024 17:57:11 +0100 Subject: [PATCH] Update tests --- .../cli/services/dev/app-events/file-watcher.test.ts | 10 +++++++++- .../src/cli/services/dev/app-events/file-watcher.ts | 10 +++++++++- .../app/src/cli/services/dev/update-extension.test.ts | 6 ++++-- packages/app/src/cli/services/dev/update-extension.ts | 2 -- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/app/src/cli/services/dev/app-events/file-watcher.test.ts b/packages/app/src/cli/services/dev/app-events/file-watcher.test.ts index 07f9f3e6c6..ddd76656f2 100644 --- a/packages/app/src/cli/services/dev/app-events/file-watcher.test.ts +++ b/packages/app/src/cli/services/dev/app-events/file-watcher.test.ts @@ -213,7 +213,15 @@ describe('file-watcher events', () => { // Then expect(watchSpy).toHaveBeenCalledWith([joinPath(dir, '/shopify.app.toml'), joinPath(dir, '/extensions')], { - ignored: ['**/node_modules/**', '**/.git/**', '**/*.test.*', '**/dist/**', '**/*.swp', '**/generated/**'], + ignored: [ + '**/node_modules/**', + '**/.git/**', + '**/*.test.*', + '**/dist/**', + '**/*.swp', + '**/generated/**', + '**/.gitignore', + ], ignoreInitial: true, persistent: true, }) diff --git a/packages/app/src/cli/services/dev/app-events/file-watcher.ts b/packages/app/src/cli/services/dev/app-events/file-watcher.ts index e8cd175c05..b4bec20c58 100644 --- a/packages/app/src/cli/services/dev/app-events/file-watcher.ts +++ b/packages/app/src/cli/services/dev/app-events/file-watcher.ts @@ -87,7 +87,15 @@ export class FileWatcher { const watchPaths = [this.app.configuration.path, ...fullExtensionDirectories] this.watcher = chokidar.watch(watchPaths, { - ignored: ['**/node_modules/**', '**/.git/**', '**/*.test.*', '**/dist/**', '**/*.swp', '**/generated/**'], + ignored: [ + '**/node_modules/**', + '**/.git/**', + '**/*.test.*', + '**/dist/**', + '**/*.swp', + '**/generated/**', + '**/.gitignore', + ], persistent: true, ignoreInitial: true, }) diff --git a/packages/app/src/cli/services/dev/update-extension.test.ts b/packages/app/src/cli/services/dev/update-extension.test.ts index 8bc3971ebb..567530801b 100644 --- a/packages/app/src/cli/services/dev/update-extension.test.ts +++ b/packages/app/src/cli/services/dev/update-extension.test.ts @@ -13,7 +13,7 @@ import {ExtensionUpdateDraftMutationVariables} from '../../api/graphql/partners/ import {inTemporaryDirectory, mkdir, writeFile} from '@shopify/cli-kit/node/fs' import {outputInfo} from '@shopify/cli-kit/node/output' import {describe, expect, vi, test} from 'vitest' -import {joinPath} from '@shopify/cli-kit/node/path' +import {dirname, joinPath} from '@shopify/cli-kit/node/path' import {platformAndArch} from '@shopify/cli-kit/node/os' import {randomUUID} from '@shopify/cli-kit/node/crypto' @@ -206,7 +206,9 @@ describe('updateExtensionDraft()', () => { const content = 'test content' const base64Content = Buffer.from(content).toString('base64') await mkdir(joinPath(mockExtension.directory, 'dist')) - await writeFile(joinPath(mockExtension.directory, 'dist', filepath), content) + const outputPath = mockExtension.getOutputPathForDirectory(tmpDir) + await mkdir(dirname(outputPath)) + await writeFile(outputPath, content) await updateExtensionDraft({ extension: mockExtension, diff --git a/packages/app/src/cli/services/dev/update-extension.ts b/packages/app/src/cli/services/dev/update-extension.ts index 7a799bfe2e..e20d189312 100644 --- a/packages/app/src/cli/services/dev/update-extension.ts +++ b/packages/app/src/cli/services/dev/update-extension.ts @@ -39,9 +39,7 @@ export async function updateExtensionDraft({ }: UpdateExtensionDraftOptions) { let encodedFile: string | undefined const outputPath = extension.getOutputPathForDirectory(bundlePath) - if (extension.features.includes('esbuild')) { - const outputPath = extension.getOutputPathForDirectory(bundlePath) const content = await readFile(outputPath) if (!content) return encodedFile = Buffer.from(content).toString('base64')