Class: Jasmine::Headless::FilesList
- Inherits:
-
Object
- Object
- Jasmine::Headless::FilesList
- Defined in:
- lib/tasks/jasmine_headless_coverage_patches.rb
Instance Method Summary collapse
- #old_sprockets_environment ⇒ Object
- #old_to_html ⇒ Object
- #sprockets_environment ⇒ Object
- #to_html(files) ⇒ Object
Instance Method Details
#old_sprockets_environment ⇒ Object
89 |
# File 'lib/tasks/jasmine_headless_coverage_patches.rb', line 89 alias old_sprockets_environment :sprockets_environment |
#old_to_html ⇒ Object
60 |
# File 'lib/tasks/jasmine_headless_coverage_patches.rb', line 60 alias old_to_html :to_html |
#sprockets_environment ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/tasks/jasmine_headless_coverage_patches.rb', line 91 def sprockets_environment return @sprockets_environment if @sprockets_environment old_sprockets_environment # Add the location of our jscoverage.js @sprockets_environment.append_path(File.dirname(__FILE__)) @sprockets_environment end |
#to_html(files) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/tasks/jasmine_headless_coverage_patches.rb', line 62 def to_html(files) # Declare our test runner files cov_files = ['/jscoverage.js', '/coverage_output_generator.js'] # Add the original files, remapping to instrumented where necessary = [] (old_to_html files).each do |path| files_map = Jasmine::Coverage.resources files_map.keys.each do |folder| path = path.sub(folder, files_map[folder]) # Here we must check the supplied config hasn't pulled in our jscoverage runner file. # If it has, the tests will fire too early, capturing only minimal coverage if cov_files.select { |f| path.include?(f) }.length > 0 fail "Assets defined by jasmine.yml must not include any of #{cov_files}: #{path}" end end << path end # Attach the "in context" test runners = + old_to_html(cov_files.map { |f| File.dirname(__FILE__)+f }) end |