Skip to content

Commit 60f74d1

Browse files
committed
test update after rebase with main
1 parent dd52aa9 commit 60f74d1

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

packages/theme/src/cli/utilities/theme-command.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('ThemeCommand', () => {
8080
await command.run()
8181

8282
// Then
83-
expect(loadEnvironment).toHaveBeenCalledWith('development', 'shopify.theme.toml')
83+
expect(loadEnvironment).toHaveBeenCalledWith('development', 'shopify.theme.toml', {from: undefined})
8484
expect(ensureAuthenticatedThemes).toHaveBeenCalledTimes(1)
8585
expect(renderConcurrent).not.toHaveBeenCalled()
8686
expect(command.commandCalls).toHaveLength(1)
@@ -110,8 +110,8 @@ describe('ThemeCommand', () => {
110110
await command.run()
111111

112112
// Then
113-
expect(loadEnvironment).toHaveBeenCalledWith('development', 'shopify.theme.toml')
114-
expect(loadEnvironment).toHaveBeenCalledWith('staging', 'shopify.theme.toml')
113+
expect(loadEnvironment).toHaveBeenCalledWith('development', 'shopify.theme.toml', {from: undefined, silent: true})
114+
expect(loadEnvironment).toHaveBeenCalledWith('staging', 'shopify.theme.toml', {from: undefined, silent: true})
115115
expect(ensureAuthenticatedThemes).toHaveBeenCalledTimes(2)
116116

117117
expect(renderConcurrent).toHaveBeenCalledOnce()

packages/theme/src/cli/utilities/theme-command.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,19 @@ export default abstract class ThemeCommand extends Command {
7272

7373
// If only one environment is specified, treat it as single environment mode
7474
if (environments.length === 1) {
75-
const environmentConfig = await loadEnvironment(environments[0], 'shopify.theme.toml', {from: flags.path})
75+
const environmentName = environments[0]
76+
// If the environment is the default environment, the config is already available.
77+
if (environmentName === 'default') {
78+
const session = await this.ensureAuthenticated(flags)
79+
await this.command(flags, session)
80+
return
81+
}
82+
83+
// For non-default environments, we need to load the config
84+
const environmentConfig = await loadEnvironment(environmentName, 'shopify.theme.toml', {
85+
from: flags.path,
86+
silent: true,
87+
})
7688
const environmentFlags = {
7789
...flags,
7890
...environmentConfig,
@@ -92,7 +104,10 @@ export default abstract class ThemeCommand extends Command {
92104
// with authentication happening in parallel.
93105
for (const environmentName of environments) {
94106
// eslint-disable-next-line no-await-in-loop
95-
const environmentConfig = await loadEnvironment(environmentName, 'shopify.theme.toml', {from: flags.path})
107+
const environmentConfig = await loadEnvironment(environmentName, 'shopify.theme.toml', {
108+
from: flags.path,
109+
silent: true,
110+
})
96111
// eslint-disable-next-line no-await-in-loop
97112
sessions[environmentName] = await this.ensureAuthenticated(environmentConfig as FlagValues)
98113
}
@@ -104,7 +119,10 @@ export default abstract class ThemeCommand extends Command {
104119
processes: environments.map((environment: string) => ({
105120
prefix: environment,
106121
action: async (stdout: Writable, stderr: Writable, _signal) => {
107-
const environmentConfig = await loadEnvironment(environment, 'shopify.theme.toml', {from: flags.path})
122+
const environmentConfig = await loadEnvironment(environment, 'shopify.theme.toml', {
123+
from: flags.path,
124+
silent: true,
125+
})
108126
const environmentFlags = {
109127
...flags,
110128
...environmentConfig,

0 commit comments

Comments
 (0)