jasmine-headless-webkit 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
 - data/CHANGELOG.md +27 -0
 - data/Rakefile +15 -3
 - data/bin/jasmine-headless-webkit +1 -8
 - data/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +10 -1
 - data/ext/jasmine-webkit-specrunner/ConsoleOutput.h +1 -0
 - data/ext/jasmine-webkit-specrunner/test.rb +9 -2
 - data/jasmine/jasmine.headless-reporter.coffee +162 -107
 - data/jasmine/jasmine.headless-reporter.js +207 -143
 - data/lib/jasmine/files_list.rb +76 -24
 - data/lib/jasmine/headless/cacheable_action.rb +6 -2
 - data/lib/jasmine/headless/options.rb +5 -1
 - data/lib/jasmine/headless/runner.rb +21 -8
 - data/lib/jasmine/headless/spec_file_analyzer.rb +10 -3
 - data/lib/jasmine/headless/template_writer.rb +41 -0
 - data/lib/jasmine/headless/version.rb +1 -1
 - data/lib/jasmine/headless.rb +24 -0
 - data/lib/jasmine-headless-webkit.rb +1 -16
 - data/skel/template.html.erb +71 -0
 - data/spec/bin/jasmine-headless-webkit_spec.rb +14 -2
 - data/spec/javascripts/jasmine.headless-reporter_spec.coffee +19 -0
 - data/spec/lib/jasmine/files_list_spec.rb +32 -3
 - data/spec/lib/jasmine/headless/cacheable_action_spec.rb +8 -1
 - data/spec/lib/jasmine/headless/runner_spec.rb +59 -0
 - data/spec/lib/jasmine/headless/template_writer_spec.rb +84 -0
 - metadata +16 -14
 - data/lib/jasmine/template_writer.rb +0 -86
 - data/spec/lib/jasmine/template_writer_spec.rb +0 -37
 
    
        data/.gitignore
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 0.7.2
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Improved finding of CoffeeScript spec line locations
         
     | 
| 
      
 4 
     | 
    
         
            +
            * Improved Runner reporting of which expectations failed
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Initial vendored helper support, paving the way for Sprockets integratioon (maybe!)
         
     | 
| 
      
 6 
     | 
    
         
            +
            * Add 1.9.3-rc1 test support and fixes
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Add console.peek()
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## 0.7.1
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            * Bugfix for missing digest/sha1 import
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## 0.7.0
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            * Major C++ cleanup, now much more modular
         
     | 
| 
      
 16 
     | 
    
         
            +
            * Greatly improved object inspection and printing provided by jsDump and beautify-js
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            ## 0.6.3
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            * Ensure Rubygems is available before doing version comparison
         
     | 
| 
      
 21 
     | 
    
         
            +
            * Fix other build problems
         
     | 
| 
      
 22 
     | 
    
         
            +
            * Better output for jQuery nodes
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ## 0.6.2
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            * Clean up C++ and test running
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       1 
28 
     | 
    
         
             
            ## 0.6.1
         
     | 
| 
       2 
29 
     | 
    
         | 
| 
       3 
30 
     | 
    
         
             
            * Ensure YAML is loaded before use
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -14,12 +14,23 @@ require 'jasmine/headless/task' 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            Jasmine::Headless::Task.new
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            PLATFORMS = %w{1.8.7 1.9.2 ree 1.9.3-rc1}
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            def rvm_bundle(command = '')
         
     | 
| 
      
 20 
     | 
    
         
            +
              Bundler.with_clean_env do
         
     | 
| 
      
 21 
     | 
    
         
            +
                system %{bash -c 'unset BUNDLE_BIN_PATH && unset BUNDLE_GEMFILE && rvm #{PLATFORMS.join(',')} do bundle #{command}'}
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            class SpecFailure < StandardError; end
         
     | 
| 
      
 26 
     | 
    
         
            +
            class BundleFailure < StandardError; end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
       17 
28 
     | 
    
         
             
            namespace :spec do
         
     | 
| 
       18 
29 
     | 
    
         
             
              desc "Run on three Rubies"
         
     | 
| 
       19 
30 
     | 
    
         
             
              task :platforms do
         
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
       22 
     | 
    
         
            -
                raise  
     | 
| 
      
 31 
     | 
    
         
            +
                rvm_bundle
         
     | 
| 
      
 32 
     | 
    
         
            +
                rvm_bundle "exec rspec spec"
         
     | 
| 
      
 33 
     | 
    
         
            +
                raise SpecError.new if $?.exitstatus != 0
         
     | 
| 
       23 
34 
     | 
    
         
             
              end
         
     | 
| 
       24 
35 
     | 
    
         
             
            end
         
     | 
| 
       25 
36 
     | 
    
         | 
| 
         @@ -31,3 +42,4 @@ task :build_runner do 
     | 
|
| 
       31 
42 
     | 
    
         
             
                system %{ruby extconf.rb}
         
     | 
| 
       32 
43 
     | 
    
         
             
              end
         
     | 
| 
       33 
44 
     | 
    
         
             
            end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
    
        data/bin/jasmine-headless-webkit
    CHANGED
    
    | 
         @@ -10,19 +10,12 @@ end 
     | 
|
| 
       10 
10 
     | 
    
         
             
            $:.unshift(File.join(gem_dir, 'lib'))
         
     | 
| 
       11 
11 
     | 
    
         
             
            require 'jasmine-headless-webkit'
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            require 'jasmine/headless/errors'
         
     | 
| 
       14 
     | 
    
         
            -
            require 'jasmine/headless/runner'
         
     | 
| 
       15 
     | 
    
         
            -
            require 'jasmine/headless/options'
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
13 
     | 
    
         
             
            begin
         
     | 
| 
       18 
14 
     | 
    
         
             
              options = Jasmine::Headless::Options.from_command_line
         
     | 
| 
       19 
15 
     | 
    
         
             
              runner = Jasmine::Headless::Runner.new(options)
         
     | 
| 
       20 
16 
     | 
    
         | 
| 
       21 
17 
     | 
    
         
             
              if options[:do_list]
         
     | 
| 
       22 
     | 
    
         
            -
                files_list = Jasmine::FilesList.new(
         
     | 
| 
       23 
     | 
    
         
            -
                  :config => runner.jasmine_config
         
     | 
| 
       24 
     | 
    
         
            -
                )
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
                files_list = Jasmine::FilesList.new(:config => runner.jasmine_config)
         
     | 
| 
       26 
19 
     | 
    
         
             
                files_list.files.each { |file| puts file }
         
     | 
| 
       27 
20 
     | 
    
         
             
              else
         
     | 
| 
       28 
21 
     | 
    
         
             
                puts "Running Jasmine specs...".color(:white)
         
     | 
| 
         @@ -82,8 +82,17 @@ void ConsoleOutput::logSpecFilename(const QString &name) { 
     | 
|
| 
       82 
82 
     | 
    
         
             
            }
         
     | 
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
            void ConsoleOutput::logSpecResult(const QString &result) {
         
     | 
| 
      
 85 
     | 
    
         
            +
              QStringList lines = result.split("\n");
         
     | 
| 
      
 86 
     | 
    
         
            +
              QStringListIterator linesIterator(lines);
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       85 
88 
     | 
    
         
             
              red();
         
     | 
| 
       86 
     | 
    
         
            -
               
     | 
| 
      
 89 
     | 
    
         
            +
              while (linesIterator.hasNext()) {
         
     | 
| 
      
 90 
     | 
    
         
            +
                QString line = linesIterator.next();
         
     | 
| 
      
 91 
     | 
    
         
            +
                if (!linesIterator.hasNext())
         
     | 
| 
      
 92 
     | 
    
         
            +
                  yellow();
         
     | 
| 
      
 93 
     | 
    
         
            +
                *outputIO << "  " << qPrintable(line) << std::endl;
         
     | 
| 
      
 94 
     | 
    
         
            +
              }
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
       87 
96 
     | 
    
         
             
              clear();
         
     | 
| 
       88 
97 
     | 
    
         
             
            }
         
     | 
| 
       89 
98 
     | 
    
         | 
| 
         @@ -7,6 +7,8 @@ system %{make clean} 
     | 
|
| 
       7 
7 
     | 
    
         
             
            $: << File.expand_path("../../../lib", __FILE__)
         
     | 
| 
       8 
8 
     | 
    
         
             
            require 'qt/qmake'
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
            result = 0
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       10 
12 
     | 
    
         
             
            Dir['*_test.pro'].each do |test|
         
     | 
| 
       11 
13 
     | 
    
         
             
              FileUtils.rm_f('jhw-test')
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
         @@ -15,10 +17,15 @@ Dir['*_test.pro'].each do |test| 
     | 
|
| 
       15 
17 
     | 
    
         
             
              if File.file?('jhw-test')
         
     | 
| 
       16 
18 
     | 
    
         
             
                system %{./jhw-test}
         
     | 
| 
       17 
19 
     | 
    
         
             
                if $?.exitstatus != 0
         
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
      
 20 
     | 
    
         
            +
                  result = 1
         
     | 
| 
      
 21 
     | 
    
         
            +
                  break
         
     | 
| 
       19 
22 
     | 
    
         
             
                end
         
     | 
| 
       20 
23 
     | 
    
         
             
              else
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 24 
     | 
    
         
            +
                result = 1
         
     | 
| 
      
 25 
     | 
    
         
            +
                break
         
     | 
| 
       22 
26 
     | 
    
         
             
              end
         
     | 
| 
       23 
27 
     | 
    
         
             
            end
         
     | 
| 
       24 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
            Qt::Qmake.make!('jasmine-headless-webkit', 'specrunner.pro')
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            exit result
         
     | 
| 
         @@ -1,120 +1,175 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            if !jasmine?
         
     | 
| 
       2 
2 
     | 
    
         
             
              throw new Error("jasmine not laoded!")
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            if window.JHW
         
     | 
| 
       4 
5 
     | 
    
         
             
            # Jasmine extensions
         
     | 
| 
       5 
     | 
    
         
            -
            getSplitName = (parts) ->
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
              getSplitName = (parts) ->
         
     | 
| 
      
 7 
     | 
    
         
            +
                parts.push(String(@description).replace(/[\n\r]/g, ' '))
         
     | 
| 
      
 8 
     | 
    
         
            +
                parts
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
            jasmine.Suite.prototype.getSuiteSplitName = ->
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
              jasmine.Suite.prototype.getSuiteSplitName = ->
         
     | 
| 
      
 11 
     | 
    
         
            +
                this.getSplitName(if @parentSuite then @parentSuite.getSuiteSplitName() else [])
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            jasmine.Spec.prototype.getSpecSplitName = ->
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
              jasmine.Spec.prototype.getSpecSplitName = ->
         
     | 
| 
      
 14 
     | 
    
         
            +
                this.getSplitName(@suite.getSuiteSplitName())
         
     | 
| 
       14 
15 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
            jasmine.Suite.prototype.getSplitName = getSplitName
         
     | 
| 
       16 
     | 
    
         
            -
            jasmine.Spec.prototype.getSplitName = getSplitName
         
     | 
| 
      
 16 
     | 
    
         
            +
              jasmine.Suite.prototype.getSplitName = getSplitName
         
     | 
| 
      
 17 
     | 
    
         
            +
              jasmine.Spec.prototype.getSplitName = getSplitName
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            jasmine.Spec.prototype.getJHWSpecInformation = ->
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
              jasmine.Spec.prototype.getJHWSpecInformation = ->
         
     | 
| 
      
 20 
     | 
    
         
            +
                parts = this.getSpecSplitName()
         
     | 
| 
      
 21 
     | 
    
         
            +
                specLineInfo = HeadlessReporterResult.findSpecLine(parts)
         
     | 
| 
      
 22 
     | 
    
         
            +
                if specLineInfo.file
         
     | 
| 
      
 23 
     | 
    
         
            +
                  parts.push("#{specLineInfo.file}:#{specLineInfo.lineNumber}")
         
     | 
| 
      
 24 
     | 
    
         
            +
                else
         
     | 
| 
      
 25 
     | 
    
         
            +
                  parts.push('')
         
     | 
| 
      
 26 
     | 
    
         
            +
                parts.join("||")
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              jasmine.Spec.prototype.fail = (e) ->
         
     | 
| 
      
 29 
     | 
    
         
            +
                if e and e.sourceURL and window.CoffeeScriptToFilename
         
     | 
| 
      
 30 
     | 
    
         
            +
                  filename = e.sourceURL.split('/').pop()
         
     | 
| 
      
 31 
     | 
    
         
            +
                  if realFilename = window.CoffeeScriptToFilename[filename]
         
     | 
| 
      
 32 
     | 
    
         
            +
                    e = {
         
     | 
| 
      
 33 
     | 
    
         
            +
                      name: e.name,
         
     | 
| 
      
 34 
     | 
    
         
            +
                      message: e.message,
         
     | 
| 
      
 35 
     | 
    
         
            +
                      lineNumber: "~" + String(e.line),
         
     | 
| 
      
 36 
     | 
    
         
            +
                      sourceURL: realFilename
         
     | 
| 
      
 37 
     | 
    
         
            +
                    }
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                expectationResult = new jasmine.ExpectationResult({
         
     | 
| 
      
 40 
     | 
    
         
            +
                  passed: false,
         
     | 
| 
      
 41 
     | 
    
         
            +
                  message: if e then jasmine.util.formatException(e) else 'Exception',
         
     | 
| 
      
 42 
     | 
    
         
            +
                  trace: { stack: e.stack }
         
     | 
| 
      
 43 
     | 
    
         
            +
                })
         
     | 
| 
      
 44 
     | 
    
         
            +
                @results_.addResult(expectationResult)
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              jasmine.NestedResults.isValidSpecLine = (line) ->
         
     | 
| 
      
 47 
     | 
    
         
            +
                line.match(/^\s*expect/) != null || line.match(/^\s*return\s*expect/) != null
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              jasmine.NestedResults.parseFunction = (func) ->
         
     | 
| 
      
 50 
     | 
    
         
            +
                lines = []
         
     | 
| 
      
 51 
     | 
    
         
            +
                lineCount = 0
         
     | 
| 
      
 52 
     | 
    
         
            +
                for line in func.split("\n")
         
     | 
| 
      
 53 
     | 
    
         
            +
                  if jasmine.NestedResults.isValidSpecLine(line)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    line = line.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^return\s*/, '')
         
     | 
| 
      
 55 
     | 
    
         
            +
                    lines.push([line, lineCount])
         
     | 
| 
      
 56 
     | 
    
         
            +
                  lineCount += 1
         
     | 
| 
      
 57 
     | 
    
         
            +
                lines
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              jasmine.NestedResults.parseAndStore = (func) ->
         
     | 
| 
      
 60 
     | 
    
         
            +
                if !jasmine.NestedResults.ParsedFunctions[func]
         
     | 
| 
      
 61 
     | 
    
         
            +
                  jasmine.NestedResults.ParsedFunctions[func] = jasmine.NestedResults.parseFunction(func)
         
     | 
| 
      
 62 
     | 
    
         
            +
                jasmine.NestedResults.ParsedFunctions[func]
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              jasmine.NestedResults.ParsedFunctions = []
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              if !jasmine.WaitsBlock.prototype._execute
         
     | 
| 
      
 67 
     | 
    
         
            +
                jasmine.WaitsBlock.prototype._execute = jasmine.WaitsBlock.prototype.execute
         
     | 
| 
      
 68 
     | 
    
         
            +
                jasmine.WaitsForBlock.prototype._execute = jasmine.WaitsForBlock.prototype.execute
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                pauseAndRun = (onComplete) ->
         
     | 
| 
      
 71 
     | 
    
         
            +
                  JHW.timerPause()
         
     | 
| 
      
 72 
     | 
    
         
            +
                  this._execute ->
         
     | 
| 
      
 73 
     | 
    
         
            +
                    JHW.timerDone()
         
     | 
| 
      
 74 
     | 
    
         
            +
                    onComplete()
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                jasmine.WaitsBlock.prototype.execute = pauseAndRun
         
     | 
| 
      
 77 
     | 
    
         
            +
                jasmine.WaitsForBlock.prototype.execute = pauseAndRun
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult
         
     | 
| 
      
 80 
     | 
    
         
            +
                jasmine.NestedResults.prototype.addResult = (result) ->
         
     | 
| 
      
 81 
     | 
    
         
            +
                  result.expectations = []
         
     | 
| 
      
 82 
     | 
    
         
            +
                  # always three up?
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                  result.expectations = jasmine.NestedResults.parseAndStore(arguments.callee.caller.caller.caller.toString())
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  this.addResult_(result)
         
     | 
| 
       39 
87 
     | 
    
         | 
| 
       40 
88 
     | 
    
         
             
            # Try to get the line number of a failed spec
         
     | 
| 
       41 
     | 
    
         
            -
            class window.HeadlessReporterResult
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
       61 
     | 
    
         
            -
                     
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                     
     | 
| 
       64 
     | 
    
         
            -
                       
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                         
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 89 
     | 
    
         
            +
              class window.HeadlessReporterResult
         
     | 
| 
      
 90 
     | 
    
         
            +
                constructor: (@name, @splitName) ->
         
     | 
| 
      
 91 
     | 
    
         
            +
                  @results = []
         
     | 
| 
      
 92 
     | 
    
         
            +
                addResult: (message) ->
         
     | 
| 
      
 93 
     | 
    
         
            +
                  @results.push(message)
         
     | 
| 
      
 94 
     | 
    
         
            +
                print: ->
         
     | 
| 
      
 95 
     | 
    
         
            +
                  output = @name
         
     | 
| 
      
 96 
     | 
    
         
            +
                  bestChoice = HeadlessReporterResult.findSpecLine(@splitName)
         
     | 
| 
      
 97 
     | 
    
         
            +
                  output += " (#{bestChoice.file}:#{bestChoice.lineNumber})" if bestChoice.file
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  JHW.printName(output)
         
     | 
| 
      
 100 
     | 
    
         
            +
                  for result in @results
         
     | 
| 
      
 101 
     | 
    
         
            +
                    output = result.message
         
     | 
| 
      
 102 
     | 
    
         
            +
                    if result.lineNumber
         
     | 
| 
      
 103 
     | 
    
         
            +
                      output += " (line ~#{bestChoice.lineNumber + result.lineNumber})\n  #{result.line}"
         
     | 
| 
      
 104 
     | 
    
         
            +
                    JHW.printResult(output)
         
     | 
| 
      
 105 
     | 
    
         
            +
                @findSpecLine: (splitName) ->
         
     | 
| 
      
 106 
     | 
    
         
            +
                  bestChoice = { accuracy: 0, file: null, lineNumber: null }
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
                  for file, lines of HeadlessReporterResult.specLineNumbers
         
     | 
| 
      
 109 
     | 
    
         
            +
                    index = 0
         
     | 
| 
      
 110 
     | 
    
         
            +
                    lineNumber = 0
         
     | 
| 
      
 111 
     | 
    
         
            +
                    while newLineNumberInfo = lines[splitName[index]]
         
     | 
| 
      
 112 
     | 
    
         
            +
                      if newLineNumberInfo.length == 0
         
     | 
| 
      
 113 
     | 
    
         
            +
                        lineNumber = newLineNumberInfo[0]
         
     | 
| 
      
 114 
     | 
    
         
            +
                      else
         
     | 
| 
      
 115 
     | 
    
         
            +
                        lastLine = null
         
     | 
| 
      
 116 
     | 
    
         
            +
                        for line in newLineNumberInfo
         
     | 
| 
      
 117 
     | 
    
         
            +
                          lastLine = line
         
     | 
| 
      
 118 
     | 
    
         
            +
                          break if line > lineNumber
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                        lineNumber = lastLine
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                      index++
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                    if index > bestChoice.accuracy
         
     | 
| 
      
 125 
     | 
    
         
            +
                      bestChoice = { accuracy: index, file: file, lineNumber: lineNumber }
         
     | 
| 
      
 126 
     | 
    
         
            +
                  
         
     | 
| 
      
 127 
     | 
    
         
            +
                  bestChoice
         
     | 
| 
       77 
128 
     | 
    
         | 
| 
       78 
129 
     | 
    
         
             
            # The reporter itself.
         
     | 
| 
       79 
     | 
    
         
            -
            class jasmine.HeadlessReporter
         
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
                     
     | 
| 
       109 
     | 
    
         
            -
                       
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
      
 130 
     | 
    
         
            +
              class jasmine.HeadlessReporter
         
     | 
| 
      
 131 
     | 
    
         
            +
                constructor: (@callback = null) ->
         
     | 
| 
      
 132 
     | 
    
         
            +
                  @results = []
         
     | 
| 
      
 133 
     | 
    
         
            +
                  @failedCount = 0
         
     | 
| 
      
 134 
     | 
    
         
            +
                  @length = 0
         
     | 
| 
      
 135 
     | 
    
         
            +
                reportRunnerResults: (runner) ->
         
     | 
| 
      
 136 
     | 
    
         
            +
                  return if this.hasError()
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
                  for result in @results
         
     | 
| 
      
 139 
     | 
    
         
            +
                    result.print()
         
     | 
| 
      
 140 
     | 
    
         
            +
             
     | 
| 
      
 141 
     | 
    
         
            +
                  this.callback() if @callback
         
     | 
| 
      
 142 
     | 
    
         
            +
                  JHW.finishSuite((new Date() - @startTime) / 1000.0, @length, @failedCount)
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
                reportRunnerStarting: (runner) ->
         
     | 
| 
      
 145 
     | 
    
         
            +
                  @startTime = new Date()
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                reportSpecResults: (spec) ->
         
     | 
| 
      
 148 
     | 
    
         
            +
                  return if this.hasError()
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                  results = spec.results()
         
     | 
| 
      
 151 
     | 
    
         
            +
                  @length++
         
     | 
| 
      
 152 
     | 
    
         
            +
                  if results.passed()
         
     | 
| 
      
 153 
     | 
    
         
            +
                    JHW.specPassed(spec.getJHWSpecInformation())
         
     | 
| 
      
 154 
     | 
    
         
            +
                  else
         
     | 
| 
      
 155 
     | 
    
         
            +
                    JHW.specFailed(spec.getJHWSpecInformation())
         
     | 
| 
      
 156 
     | 
    
         
            +
                    @failedCount++
         
     | 
| 
      
 157 
     | 
    
         
            +
                    failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName())
         
     | 
| 
      
 158 
     | 
    
         
            +
                    testCount = 1
         
     | 
| 
      
 159 
     | 
    
         
            +
                    for result in results.getItems()
         
     | 
| 
      
 160 
     | 
    
         
            +
                      if result.type == 'expect' and !result.passed_
         
     | 
| 
      
 161 
     | 
    
         
            +
                        if foundLine = result.expectations[testCount - 1]
         
     | 
| 
      
 162 
     | 
    
         
            +
                          [ result.line, result.lineNumber ] = foundLine
         
     | 
| 
      
 163 
     | 
    
         
            +
                        failureResult.addResult(result)
         
     | 
| 
      
 164 
     | 
    
         
            +
                      testCount += 1
         
     | 
| 
      
 165 
     | 
    
         
            +
                    @results.push(failureResult)
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                reportSpecStarting: (spec) ->
         
     | 
| 
      
 168 
     | 
    
         
            +
                  if this.hasError()
         
     | 
| 
      
 169 
     | 
    
         
            +
                    spec.finish()
         
     | 
| 
      
 170 
     | 
    
         
            +
                    spec.suite.finish()
         
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                reportSuiteResults: (suite) ->
         
     | 
| 
      
 173 
     | 
    
         
            +
                hasError: ->
         
     | 
| 
      
 174 
     | 
    
         
            +
                  JHW.hasError()
         
     | 
| 
       120 
175 
     | 
    
         |