Sha256: 33f32abbb3e9d31b9145877c500e3a09b8d6da4a65cf05797bfe2d5e4180b0cf

Contents?: true

Size: 1.24 KB

Versions: 26

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

# You can replace this implementation with your own for use by the
# ReactOnRails::TestHelper.ensure_assets_compiled helper
module ReactOnRails
  module TestHelper
    class WebpackAssetsCompiler
      def compile_assets
        if ReactOnRails.configuration.build_test_command.blank?
          msg = <<~MSG
            You are using the React on Rails test helper.
            Either you used:
              ReactOnRails::TestHelper.configure_rspec_to_compile_assets or
              ReactOnRails::TestHelper.ensure_assets_compiled
            but you did not specify the config.build_test_command

            React on Rails is aborting your test run

            If you wish to use the config/webpacker.yml compile option for tests
            them remove your call to the ReactOnRails test helper.
          MSG
          puts Rainbow(msg).red
          exit!(1)
        end

        puts "\nBuilding Webpack assets..."

        cmd = ReactOnRails::Utils.prepend_cd_node_modules_directory(
          ReactOnRails.configuration.build_test_command
        )

        ReactOnRails::Utils.invoke_and_exit_if_failed(cmd, "Error in building webpack assets!")

        puts "Completed building Webpack assets."
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
react_on_rails-12.4.0.rc.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-12.3.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-12.2.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-12.1.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-12.0.5.beta.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-12.0.4 lib/react_on_rails/test_helper/webpack_assets_compiler.rb