Sha256: 06aced8af2d0eb6dd8c0898addeae05692de124cf9b5af441fc51de38d7d9da8

Contents?: true

Size: 1000 Bytes

Versions: 6

Compression:

Stored size: 1000 Bytes

Contents

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(/\sit\s*\(/) { |s| count += 1 }
        count
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
evergreen-1.3.0 lib/jasmine/tasks/jasmine_dev/count_specs.rb
evergreen-1.2.0 lib/jasmine/tasks/jasmine_dev/count_specs.rb
evergreen-1.1.3 lib/jasmine/tasks/jasmine_dev/count_specs.rb
evergreen-1.1.2 lib/jasmine/tasks/jasmine_dev/count_specs.rb
evergreen-1.1.0 lib/jasmine/tasks/jasmine_dev/count_specs.rb
evergreen-1.0.1 lib/jasmine/tasks/jasmine_dev/count_specs.rb