Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacroldan committed Nov 29, 2024
1 parent 642bebd commit 0442d42
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
10 changes: 9 additions & 1 deletion packages/app/src/cli/services/dev/app-events/file-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
6 changes: 4 additions & 2 deletions packages/app/src/cli/services/dev/update-extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions packages/app/src/cli/services/dev/update-extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 0442d42

Please sign in to comment.