Skip to content

Commit a8aee22

Browse files
Improve logs for acceptance tests
1 parent 415d367 commit a8aee22

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

packages/features/lib/system.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,23 @@ export function exec(command: string, args: string[] = [], options?: ExecOptions
2222

2323
const _options = {
2424
...options,
25-
stdout: undefined,
26-
stderr: undefined,
2725
env: {...process.env, ...(options?.env ?? {}), SHOPIFY_RUN_AS_USER: '0'},
2826
}
2927
const shortCommand = command.split('/').slice(-1).pop() || ''
3028
const commandProcess = execa(command, args, _options)
31-
commandProcess.stdout?.on('data', (data: string) => {
32-
if (isDebug) {
33-
console.log(colors.gray(`${colors.bold(shortCommand)}: ${data}`))
34-
}
35-
})
36-
commandProcess.stderr?.on('data', (data: string) => {
37-
if (isDebug) {
38-
console.log(colors.gray(`${colors.bold(shortCommand)}: ${data}`))
39-
}
40-
})
29+
30+
// Only attach debug event handlers if we're in debug mode
31+
// Note: We use .pipe() to avoid consuming the data and preventing capture
32+
if (isDebug && commandProcess.stdout) {
33+
commandProcess.stdout.on('data', (data: Buffer) => {
34+
console.log(colors.gray(`${colors.bold(shortCommand)}: ${data.toString()}`))
35+
})
36+
}
37+
if (isDebug && commandProcess.stderr) {
38+
commandProcess.stderr.on('data', (data: Buffer) => {
39+
console.log(colors.gray(`${colors.bold(shortCommand)}: ${data.toString()}`))
40+
})
41+
}
42+
4143
return commandProcess
4244
}

packages/features/steps/app.steps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ async function generateExtension({name, type, directory, extraArgs, env}: Genera
123123
],
124124
{env},
125125
)
126-
// eslint-disable-next-line no-catch-all/no-catch-all
127-
} catch {
128-
assert.ok(true)
126+
} catch (error) {
127+
console.error(`Failed to generate extension: ${name} of type ${type}`, error)
128+
throw error
129129
}
130130
}

0 commit comments

Comments
 (0)