Skip to content

Commit

Permalink
adds the ability to ignore files when instrumenting
Browse files Browse the repository at this point in the history
  • Loading branch information
matstc committed Mar 27, 2014
1 parent f79bc62 commit 89ed1fa
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,9 @@ coverage_html_dir: './coverage' # Directory to write Istanbul HTML

coverage_summary: true # Enable Istanbul summary coverage report
# default: false

ignore_instrumentation: 'vendor' # Ignore files matching this regex when instrumenting
# default: ''
```

The `:coverage_summary` options disables the detailed file based coverage report by a small summary coverage report.
Expand Down
6 changes: 6 additions & 0 deletions lib/guard/jasmine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ class CLI < Thor
default: false,
desc: 'Whether to generate html coverage summary. Implies --coverage'

method_option :ignore_instrumentation,
type: :string,
default: "",
desc: 'Files matching this regex will not be instrumented (e.g. vendor)'

method_option :statements_threshold,
type: :numeric,
default: 0,
Expand Down Expand Up @@ -189,6 +194,7 @@ def spec(*paths)
runner_options[:coverage_html] = options.coverage_html || options.coverage_html_dir != "./coverage"
runner_options[:coverage_html_dir] = options.coverage_html_dir
runner_options[:coverage_summary] = options.coverage_summary
runner_options[:ignore_instrumentation] = options.ignore_instrumentation
runner_options[:statements_threshold] = options.statements_threshold
runner_options[:functions_threshold] = options.functions_threshold
runner_options[:branches_threshold] = options.branches_threshold
Expand Down
1 change: 1 addition & 0 deletions lib/guard/jasmine/coverage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def prepare
# Returns a coverage instrumented JavaScript file
#
def evaluate(context, locals)
return data if !ENV['IGNORE_INSTRUMENTATION'].to_s.empty? && file =~ Regexp.new(ENV['IGNORE_INSTRUMENTATION'])
return data unless JasmineCoverage.coverage_bin
return data unless file.include?(JasmineCoverage.app_asset_path)

Expand Down
1 change: 1 addition & 0 deletions lib/guard/jasmine/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def start_rack_server(server, port, options)

self.process = ChildProcess.build(*['rackup', '-E', environment.to_s, '-p', port.to_s, '-s', server.to_s, rackup_config].compact)
self.process.environment['COVERAGE'] = options[:coverage].to_s
self.process.environment['IGNORE_INSTRUMENTATION'] = options[:ignore_instrumentation].to_s
self.process.io.inherit! if options[:verbose]
self.process.start

Expand Down
2 changes: 1 addition & 1 deletion lib/guard/jasmine/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Guard
module JasmineVersion
# Guard::Jasmine version that is used for the Gem specification
VERSION = '1.19.0'
VERSION = '1.19.1'
end
end

0 comments on commit 89ed1fa

Please sign in to comment.