Files
jasmine/tasks/jasmine_dev/count_specs.rb
Davis W. Frank & Rajan Agaskar a1011e7748 Rewrite Spec & allow Jasmine to be namespaced
- THere seems to be a performance regression. Large test suites may
  throw
- Regressions: Mock Clock won't install correctly, async specs are
  temporarily not supported.
- Async spec runs/waits interface is gone. Blocks are gone.
- Move most global usage into jasmine.Env constructor.
- Remove optional 'Jasmine running' from HtmlReporter -- caused
  NS_FACTORY_ERROR in firefox when tested
2012-12-06 09:10:24 -08:00

30 lines
1002 B
Ruby

class JasmineDev < Thor
desc "count_specs", "Count the number of specs for each test runner"
def count_specs
say JasmineDev.spacer
say "Counting specs...", :cyan
core_spec_count = count_specs_in(File.join('spec', 'core'))
console_spec_count = count_specs_in(File.join('spec', 'console'))
html_spec_count = count_specs_in(File.join('spec', 'html'))
say "#{(core_spec_count + console_spec_count).to_s} ", :yellow
say "specs for Node.js runner (exclude DOM-related specs)"
say "#{(core_spec_count + console_spec_count + html_spec_count).to_s} ", :yellow
say "specs for Browser runner (all specs)"
say "\n"
say "Please verify that these numbers match the runner output."
end
no_tasks do
def count_specs_in(relative_path)
files = Dir.glob(File.join(JasmineDev.project_root, relative_path, '*.js'))
files.inject(0) do |count, file|
File.read(file).scan(/^\s*it\(.*/) { |s| count += 1 }
count
end
end
end
end