Class: ReactOnRails::TestHelper::WebpackAssetsCompiler

Inherits:
Object
  • Object
show all
Defined in:
lib/react_on_rails/test_helper/webpack_assets_compiler.rb

Instance Method Summary collapse

Instance Method Details

#compile_assetsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/react_on_rails/test_helper/webpack_assets_compiler.rb', line 8

def compile_assets
  if ReactOnRails.configuration.build_test_command.blank?
    msg = "      You are using the React on Rails test helper.\n      Either you used:\n        ReactOnRails::TestHelper.configure_rspec_to_compile_assets or\n        ReactOnRails::TestHelper.ensure_assets_compiled\n      but you did not specify the config.build_test_command\n\n      React on Rails is aborting your test run\n\n      If you wish to use the config/webpacker.yml compile option for tests\n      them remove your call to the ReactOnRails test helper.\n    MSG\n    puts Rainbow(msg).red\n    exit!(1)\n  end\n\n  puts \"\\nBuilding Webpack assets...\"\n\n  cmd = ReactOnRails::Utils.prepend_cd_node_modules_directory(\n    ReactOnRails.configuration.build_test_command\n  )\n\n  ReactOnRails::Utils.invoke_and_exit_if_failed(cmd, \"Error in building webpack assets!\")\n\n  puts \"Completed building Webpack assets.\"\nend\n"