Sha256: bbd9bc21ab066196d52a3a448545f36008fca619d3cf3f4d894e1a60384fd7a5

Contents?: true

Size: 1.01 KB

Versions: 10

Compression:

Stored size: 1.01 KB

Contents

# 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
        compile_type(:client)
        compile_type(:server) if Utils.server_rendering_is_enabled?
      end

      private

      def compile_type(type)
        unless @printed_msg
          puts <<-MSG
If you are frequently running tests, you can run webpack in watch mode to speed up this process.
See the official documentation:
https://github.com/shakacode/react_on_rails/blob/master/docs/additional_reading/rspec_configuration.md
          MSG
          @printed_msg = true
        end

        puts "\nBuilding Webpack #{type}-rendering assets..."

        build_output = `cd client && npm run build:#{type}`

        fail "Error in building assets!\n#{build_output}" unless Utils.last_process_completed_successfully?

        puts "Completed building Webpack #{type}-rendering assets."
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
react_on_rails-3.0.6 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.5 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.4 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.3 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.2 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.1 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.0 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.0.rc.2 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.0.rc.1 lib/react_on_rails/test_helper/webpack_assets_compiler.rb
react_on_rails-3.0.0.beta.1 lib/react_on_rails/test_helper/webpack_assets_compiler.rb