diff --git a/CHANGELOG.md b/CHANGELOG.md index 60a97a885..5584cb917 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ From version 2.6.0, the sections in this file adhere to the [keep a changelog](h ### Fixed * [#2721](https://github.com/Shopify/shopify-cli/pull/2721): Do not `replace_asset_urls` in font bodies * [#2729](https://github.com/Shopify/shopify-cli/pull/2729): Do not inject hot-reload code into web-pixels-manager sandbox (from cli#1370) +* [#2730](https://github.com/Shopify/shopify-cli/pull/2730): Remove "Current theme directory can't be confirmed during tests" check ### Added * [#2724](https://github.com/Shopify/shopify-cli/pull/2724): Introduce hidden `--overwrite-json` flag diff --git a/lib/project_types/theme/commands/common/root_helper.rb b/lib/project_types/theme/commands/common/root_helper.rb index e242a0e4a..584f867cb 100644 --- a/lib/project_types/theme/commands/common/root_helper.rb +++ b/lib/project_types/theme/commands/common/root_helper.rb @@ -49,12 +49,14 @@ def exist_and_not_empty?(root) private def current_directory_confirmed? - raise "Current theme directory can't be confirmed during tests" if @ctx.testing? + message = @ctx.message("theme.current_directory_is_not_theme_directory") + @ctx.abort(message) unless ShopifyCLI::Environment.interactive? + message += " \n#{@ctx.message("theme.confirm_current_directory")}" Forms::ConfirmStore.ask( @ctx, [], - title: @ctx.message("theme.confirm_current_directory"), + title: message, force: options.flags[:force], ).confirmed? end diff --git a/lib/project_types/theme/messages/messages.rb b/lib/project_types/theme/messages/messages.rb index ecca52870..b2f75199d 100644 --- a/lib/project_types/theme/messages/messages.rb +++ b/lib/project_types/theme/messages/messages.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + module Theme module Messages MESSAGES = { @@ -18,8 +19,9 @@ module Messages ENSURE_USER stable_flag_suggestion: "If the current command isn't working as expected," \ " we suggest re-running the command with the {{command: --stable}} flag", - confirm_current_directory: "It doesn’t seem like you’re running this command in a theme directory. " \ - "Are you sure you want to proceed?", + current_directory_is_not_theme_directory: "It doesn’t seem like you’re running this command" \ + " in a theme directory.", + confirm_current_directory: "Are you sure you want to proceed?", init: { help: <<~HELP, {{command:%s theme init}}: Clones a Git repository to use as a starting point for building a new theme.