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



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

def default_rack_env = "development"

#descriptionObject



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

def description = "Run JavaScript unit tests"

#detailed_descriptionObject



125
126
127
# File 'lib/brut/cli/apps/test.rb', line 125

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

#optsObject



122
123
124
# File 'lib/brut/cli/apps/test.rb', line 122

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

#runObject



129
130
131
132
133
134
135
136
137
138
# File 'lib/brut/cli/apps/test.rb', line 129

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