Class: Hippo::Command::Jest

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/hippo/command/jest.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/hippo/command/jest.rb', line 11

def config
  @config
end

Instance Method Details

#config_fileObject



26
27
28
# File 'lib/hippo/command/jest.rb', line 26

def config_file
    config.directory.join('jest.config.json')
end

#configureObject



19
20
21
22
23
24
# File 'lib/hippo/command/jest.rb', line 19

def configure
    @extension ||= Command.load_current_extension(raise_on_fail:true)
    @config = Hippo::Webpack::ClientConfig.new
    @config.invoke_all
    self
end

#startObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/hippo/command/jest.rb', line 30

def start
    say 'Starting Jest', :green
    say Dir.pwd, :yellow
    cmd = "$(npm bin)/jest --config #{config_file}"
    options.each do |key, value|
        cmd << " --#{key}" if value
    end
    say cmd, :green
    exec(cmd)
end