Class: JasmineNodeCoverageRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(jasmine_runner, coverage, config) ⇒ JasmineNodeCoverageRunner

Returns a new instance of JasmineNodeCoverageRunner.


5
6
7
8
9
# File 'lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb', line 5

def initialize(jasmine_runner, coverage, config)
  @jasmine_runner = jasmine_runner
  @coverage = coverage
  @config = config
end

Instance Method Details

#executeObject


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb', line 15

def execute
  @config.reload

  source_dir = @config.source_dir
  coverage_dir = source_dir + "-cov"

  FileUtils.rm_rf coverage_dir
  
  output = @coverage.run source_dir, coverage_dir
  @jasmine_runner.source_dir coverage_dir
  return output + "\n\n" + @jasmine_runner.execute
end

#is_configured?(all_files) ⇒ Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb', line 28

def is_configured?(all_files)
  return @jasmine_runner.is_configured? all_files
end

#nameObject


11
12
13
# File 'lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb', line 11

def name
  return 'Coverage'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/tasks/jasmine_node_coverage/jasmine_node_coverage_runner.rb', line 32

def should_run?(modified_files)
  return @jasmine_runner.should_run? modified_files
end