Class: Brut::CLI::Apps::Test::Js

Inherits:
Commands::BaseCommand show all
Defined in:
lib/brut/cli/apps/test.rb

Instance Attribute Summary

Attributes inherited from Commands::BaseCommand

#parent_command

Instance Method Summary collapse

Methods inherited from Commands::BaseCommand

#accepts, #args_description, #argv, #bootstrap?, #commands, #delegate_to_command, #env, #env_vars, #execute, #name, #options, #puts, #stdin, #system!, #theme

Instance Method Details

#default_rack_envObject



113
# File 'lib/brut/cli/apps/test.rb', line 113

def default_rack_env = "development"

#descriptionObject



114
# File 'lib/brut/cli/apps/test.rb', line 114

def description = "Run JavaScript unit tests"

#detailed_descriptionObject



118
119
120
# File 'lib/brut/cli/apps/test.rb', line 118

def detailed_description = %{
   Runs all JavaScript unit tests for the app.  This does not support running individual tests.
}

#optsObject



115
116
117
# File 'lib/brut/cli/apps/test.rb', line 115

def opts = [
  [ "--[no-]build-assets","Build all assets before running the tests" ],
]

#runObject



122
123
124
125
126
127
128
129
130
131
# File 'lib/brut/cli/apps/test.rb', line 122

def run
  options.set_default(:"build-assets", true)
  if options.build_assets?
    Bundler.with_unbundled_env do
      system!({ "RACK_ENV" => "test" }, "brut build-assets all")
    end
  end
  execution_context.executor.system!({ "NODE_DISABLE_COLORS" => "1" },"npx mocha #{Brut.container.js_specs_dir} --no-color --extension 'spec.js' --recursive")
  0
end