Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/app/src/cli/services/build/client-steps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ describe('executeStep', () => {
if (result.success) expect(result.output).toEqual({filesCopied: 3})
expect(result.duration).toBeGreaterThanOrEqual(0)
})

test('logs step execution to stdout', async () => {
vi.mocked(stepsIndex.executeStepByType).mockResolvedValue({})

await executeStep(step, mockContext)

expect(mockContext.options.stdout.write).toHaveBeenCalledWith('Executing step: Test Step\n')
})
})

describe('failure', () => {
Expand Down
1 change: 0 additions & 1 deletion packages/app/src/cli/services/build/client-steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export async function executeStep(step: LifecycleStep, context: BuildContext): P
const startTime = Date.now()

try {
context.options.stdout.write(`Executing step: ${step.name}\n`)
const output = await executeStepByType(step, context)

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ describe('executeIncludeAssetsStep', () => {
// Then — no error, no copies
expect(result.filesCopied).toBe(0)
expect(fs.copyDirectoryContents).not.toHaveBeenCalled()
expect(mockStdout.write).toHaveBeenCalledWith(expect.stringContaining("No value for configKey 'static_root'"))
})

test('skips path that does not exist on disk but logs a warning', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('copyConfigKeyEntry', () => {
})
})

test('skips with log message when configKey is absent from configuration', async () => {
test('skips when configKey is absent from configuration', async () => {
await inTemporaryDirectory(async (tmpDir) => {
const outDir = joinPath(tmpDir, 'out')
await mkdir(outDir)
Expand All @@ -100,7 +100,6 @@ describe('copyConfigKeyEntry', () => {

expect(result.filesCopied).toBe(0)
expect(result.pathMap.size).toBe(0)
expect(mockStdout.write).toHaveBeenCalledWith("No value for configKey 'static_root', skipping\n")
})
})

Expand Down Expand Up @@ -199,7 +198,7 @@ describe('copyConfigKeyEntry', () => {
})
})

test('skips with no-value log when [] flatten resolves to a non-array (contract violated)', async () => {
test('skips when [] flatten resolves to a non-array (contract violated)', async () => {
await inTemporaryDirectory(async (tmpDir) => {
const outDir = joinPath(tmpDir, 'out')
await mkdir(outDir)
Expand All @@ -215,9 +214,6 @@ describe('copyConfigKeyEntry', () => {

expect(result.filesCopied).toBe(0)
expect(result.pathMap.size).toBe(0)
expect(mockStdout.write).toHaveBeenCalledWith(
expect.stringContaining("No value for configKey 'extensions[].targeting[].schema'"),
)
})
})

Expand Down

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Design: The function takes both context: BuildContext (inside config) and a separate options: {stdout} parameter. Since context.options already carries stdout, the second parameter is redundant — every caller passes context.options as the second argument. The inconsistency in the new outputDebug call (reaching for context.options.stdout instead of options.stdout) highlights this duplication.

Suggestion: Consider removing the options parameter and using context.options.stdout (or a local alias) throughout the function. This would require updating the call site in include-assets-step.ts and the test helper, so it may be better suited for a follow-up.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {joinPath, basename, relativePath, extname} from '@shopify/cli-kit/node/path'
import {glob, copyFile, copyDirectoryContents, fileExists, mkdir, isDirectory} from '@shopify/cli-kit/node/fs'
import {outputDebug} from '@shopify/cli-kit/node/output'
import type {BuildContext} from '../../client-steps.js'

/**
Expand Down Expand Up @@ -41,7 +42,7 @@ export async function copyConfigKeyEntry(
}

if (paths.length === 0) {
options.stdout.write(`No value for configKey '${key}', skipping\n`)
outputDebug(`No value for configKey '${key}', skipping\n`, context.options.stdout)
return {filesCopied: 0, pathMap: new Map()}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {getNestedValue, tokenizePath} from './copy-config-key-entry.js'
import {joinPath} from '@shopify/cli-kit/node/path'
import {fileExists, mkdir, writeFile} from '@shopify/cli-kit/node/fs'
import {outputDebug} from '@shopify/cli-kit/node/output'
import type {BuildContext} from '../../client-steps.js'

interface ConfigKeyManifestEntry {
Expand Down Expand Up @@ -120,7 +121,7 @@ export async function generateManifestFile(
}
await mkdir(outputDir)
await writeFile(manifestPath, JSON.stringify(manifest, null, 2))
options.stdout.write(`Generated manifest.json in ${outputDir}\n`)
outputDebug(`Generated manifest.json in ${outputDir}\n`, options.stdout)
}

/**
Expand Down
Loading