File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -295,7 +295,7 @@ def check_react_on_rails_initializer
295295
296296 # Webpack configuration validation
297297 def check_webpack_configuration
298- config_path = detect_bundler_config_path
298+ config_path = resolved_webpack_config_path
299299 if config_path
300300 add_success ( "✅ Bundler configuration exists (#{ config_path } )" )
301301 check_webpack_config_content ( config_path )
Original file line number Diff line number Diff line change 559559 end
560560 end
561561
562+ describe "#check_webpack_configuration" do
563+ context "when webpack config is resolved from a custom shakapacker location" do
564+ before do
565+ allow ( checker ) . to receive ( :resolved_webpack_config_path ) . and_return ( "config/custom/webpack.config.ts" )
566+ allow ( checker ) . to receive ( :check_webpack_config_content )
567+ allow ( checker ) . to receive ( :suggest_webpack_inspection )
568+ end
569+
570+ it "reports success instead of an error" do
571+ checker . check_webpack_configuration
572+
573+ expect ( checker . messages . any? do |msg |
574+ msg [ :type ] == :success && msg [ :content ] . include? ( "config/custom/webpack.config.ts" )
575+ end ) . to be true
576+ expect ( checker . errors? ) . to be false
577+ end
578+ end
579+
580+ context "when no webpack config can be resolved" do
581+ before do
582+ allow ( checker ) . to receive ( :resolved_webpack_config_path ) . and_return ( nil )
583+ end
584+
585+ it "reports an error" do
586+ checker . check_webpack_configuration
587+
588+ expect ( checker . errors? ) . to be true
589+ expect ( checker . messages . last [ :content ] ) . to include ( "Bundler configuration not found" )
590+ end
591+ end
592+ end
593+
562594 describe "#check_react_dependencies" do
563595 let ( :base_package_json ) do
564596 {
You can’t perform that action at this time.
0 commit comments