clean up how reporting is done somoe more
This commit is contained in:
parent
0adf3a41b6
commit
d31f628d91
@ -1,7 +1,7 @@
|
||||
Feature: Bin - Failure
|
||||
Scenario: Run a failing test
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 1
|
||||
And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
|
||||
|
||||
|
7
features/bin/files.feature
Normal file
7
features/bin/files.feature
Normal file
@ -0,0 +1,7 @@
|
||||
Feature: Bin - Files
|
||||
Scenario: List the files a test suite will use
|
||||
Given I have a test suite
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml -l`
|
||||
Then the exit status should be 0
|
||||
And the output should include "spec/jasmine/success/success.js"
|
||||
And the output should include "spec/jasmine/success/success_spec.js"
|
@ -3,16 +3,16 @@ Feature: Bin - Filtered Run - Both Runs
|
||||
Given there is no existing "spec/report.txt" file
|
||||
|
||||
Scenario: Run one and fail
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml --format HeadlessFileReporter --out spec/report.txt ./spec/jasmine/filtered_failure/failure_spec.js`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml -f File:spec/report.txt ./spec/jasmine/filtered_failure/failure_spec.js`
|
||||
Then the exit status should be 1
|
||||
And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
|
||||
|
||||
Scenario: Run both and succeed
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --format HeadlessFileReporter --out spec/report.txt ./spec/jasmine/filtered_success/success_one_spec.js`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success/success_one_spec.js`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 2 total, 0 failures, no console usage
|
||||
|
||||
Scenario: Run both with console.log
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success_with_console/filtered_success.yml --format HeadlessFileReporter --out spec/report.txt ./spec/jasmine/filtered_success_with_console/success_one_spec.js`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success_with_console/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success_with_console/success_one_spec.js`
|
||||
Then the exit status should be 2
|
||||
And the report file "spec/report.txt" should have 2 total, 0 failures, yes console usage
|
||||
|
@ -3,12 +3,12 @@ Feature: Bin - No Full Run
|
||||
Given there is no existing "spec/report.txt" file
|
||||
|
||||
Scenario: Only run the filtered run
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --format HeadlessFileReporter --out spec/report.txt --no-full-run ./spec/jasmine/filtered_success/success_one_spec.js`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt --no-full-run ./spec/jasmine/filtered_success/success_one_spec.js`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failure, no console usage
|
||||
|
||||
Scenario: Use a file outside of the normal test run
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --format HeadlessFileReporter --out spec/report.txt ./spec/jasmine/filtered_success/success_other_file.js`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml -f File:spec/report.txt ./spec/jasmine/filtered_success/success_other_file.js`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failure, no console usage
|
||||
|
||||
|
8
features/bin/runner_out.feature
Normal file
8
features/bin/runner_out.feature
Normal file
@ -0,0 +1,8 @@
|
||||
Feature: Bin - Runner Out
|
||||
Scenario: Write out the runner to a specified file
|
||||
Given I have a test suite
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --runner-out spec/runner.html`
|
||||
Then the exit status should be 0
|
||||
And the file "spec/runner.html" should contain a JHW runner
|
||||
When I delete the file "spec/runner.html"
|
||||
|
@ -1,7 +1,7 @@
|
||||
Feature: Bin - Success
|
||||
Scenario: Run a successful test
|
||||
Scenario: Run a successful test with long format definition
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit --seed 1234 -j spec/jasmine/success/success.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit --seed 1234 -j spec/jasmine/success/success.yml --format File --out spec/report.txt`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
|
||||
And the report file "spec/report.txt" should have seed 1234
|
||||
@ -14,7 +14,7 @@ Feature: Bin - Success
|
||||
|
||||
Scenario: Run a successful test with shortened format definition
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --format HeadlessFileReporter:spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
Feature: Bin - Success with JS Error
|
||||
Scenario: Succeed
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 1
|
||||
|
@ -1,7 +1,7 @@
|
||||
Feature: Bin - Try to Leave Page
|
||||
Scenario: Fail on trying to leave the page
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/leave_page/leave_page.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/leave_page/leave_page.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 1
|
||||
And the report file "spec/report.txt" should exist
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Feature: Bin - Try to Click A Button
|
||||
Scenario: Don't leave page when clicking a button
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/click_button/click_button.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/click_button/click_button.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 0
|
||||
And the report file "spec/report.txt" should have 0 total, 0 failures, no console usage
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Feature: Bin - With CoffeeScript error
|
||||
Scenario: Fail on CoffeeScript error
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/coffeescript_error/coffeescript_error.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/coffeescript_error/coffeescript_error.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 1
|
||||
And the report file "spec/report.txt" should not exist
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Feature: Bin - With console.log
|
||||
Feature: Use console.log
|
||||
Scenario: Run a successful test that uses console.log
|
||||
Given there is no existing "spec/report.txt" file
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/console_log/console_log.yml --format HeadlessFileReporter --out spec/report.txt`
|
||||
When I run `bin/jasmine-headless-webkit -j spec/jasmine/console_log/console_log.yml -f File:spec/report.txt`
|
||||
Then the exit status should be 2
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failures, yes console usage
|
||||
|
||||
|
@ -7,18 +7,18 @@ Feature: Reporters
|
||||
Given I have the default runner options
|
||||
When I get a runner
|
||||
And I get a template writer
|
||||
Then the template should use the "HeadlessConsoleReporter" reporter to "stdout"
|
||||
Then the template should use the "Console" reporter to "stdout"
|
||||
And the command to run the runner should not include a report file
|
||||
|
||||
Scenario: Use a file reporter
|
||||
Given I have the default runner options
|
||||
And I have the following reporters:
|
||||
| Name | File |
|
||||
| ConsoleReporter | |
|
||||
| FileReporter | file |
|
||||
| Console | |
|
||||
| File | file |
|
||||
When I get a runner
|
||||
And I get a template writer
|
||||
Then the template should use the "ConsoleReporter" reporter to "stdout"
|
||||
And the template should use the "FileReporter" reporter to "report:0"
|
||||
Then the template should use the "Console" reporter to "stdout"
|
||||
And the template should use the "File" reporter to "report:0"
|
||||
And the command to run the runner should include the report file "file"
|
||||
|
||||
|
34
features/runner.feature
Normal file
34
features/runner.feature
Normal file
@ -0,0 +1,34 @@
|
||||
Feature: Using the Runner directly
|
||||
Scenario: Succeed
|
||||
Given I have the following runner options:
|
||||
"""
|
||||
:jasmine_config: spec/jasmine/success/success.yml
|
||||
:reporters:
|
||||
- [ 'File', 'spec/report.txt' ]
|
||||
"""
|
||||
When I get a runner
|
||||
And I run the runner
|
||||
Then the runner should have an exit status of 0
|
||||
And the report file "spec/report.txt" should have 1 total, 0 failures, no console usage
|
||||
|
||||
Scenario: JavaScript Error
|
||||
Given I have the following runner options:
|
||||
"""
|
||||
:jasmine_config: spec/jasmine/success_with_error/success_with_error.yml
|
||||
"""
|
||||
When I get a runner
|
||||
And I run the runner
|
||||
Then the runner should have an exit status of 1
|
||||
|
||||
Scenario: Failure
|
||||
Given I have the following runner options:
|
||||
"""
|
||||
:jasmine_config: spec/jasmine/failure/failure.yml
|
||||
:reporters:
|
||||
- [ 'File', 'spec/report.txt' ]
|
||||
"""
|
||||
When I get a runner
|
||||
And I run the runner
|
||||
Then the runner should have an exit status of 1
|
||||
And the report file "spec/report.txt" should have 1 total, 1 failure, no console usage
|
||||
|
2
features/steps/given/i_have_test_suite.rb
Normal file
2
features/steps/given/i_have_test_suite.rb
Normal file
@ -0,0 +1,2 @@
|
||||
Given /^I have a test suite$/ do
|
||||
end
|
3
features/steps/given/options/i_have_runner_options.rb
Normal file
3
features/steps/given/options/i_have_runner_options.rb
Normal file
@ -0,0 +1,3 @@
|
||||
Given /^I have the following runner options:$/ do |string|
|
||||
@options = YAML.load(string)
|
||||
end
|
4
features/steps/then/bin/file_should_contain_runner.rb
Normal file
4
features/steps/then/bin/file_should_contain_runner.rb
Normal file
@ -0,0 +1,4 @@
|
||||
Then /^the file "([^"]*)" should contain a JHW runner$/ do |file|
|
||||
File.read(file).should include('jasmine.HeadlessReporter')
|
||||
end
|
||||
|
3
features/steps/then/bin/output_should_include.rb
Normal file
3
features/steps/then/bin/output_should_include.rb
Normal file
@ -0,0 +1,3 @@
|
||||
Then /^the output should include "([^"]*)"$/ do |string|
|
||||
@output.should include(string)
|
||||
end
|
3
features/steps/then/runner/it_should_have_exit_status.rb
Normal file
3
features/steps/then/runner/it_should_have_exit_status.rb
Normal file
@ -0,0 +1,3 @@
|
||||
Then /^the runner should have an exit status of (\d+)$/ do |exit_status|
|
||||
@result.should == exit_status.to_i
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
Then /^the template should use the "([^"]*)" reporter to "([^"]*)"$/ do |reporter, target|
|
||||
output = @template_writer.render
|
||||
|
||||
output.should include(%{jasmine.#{reporter}("#{target}")})
|
||||
output.should include(%{jasmine.HeadlessReporter.#{reporter}("#{target}")})
|
||||
end
|
||||
|
||||
|
3
features/steps/when/i_delete_file.rb
Normal file
3
features/steps/when/i_delete_file.rb
Normal file
@ -0,0 +1,3 @@
|
||||
When /^I delete the file "([^"]*)"$/ do |file|
|
||||
FileUtils.rm_f(file)
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
When /^I run `(.*)`$/ do |command|
|
||||
system command
|
||||
@output = `#{command}`
|
||||
end
|
||||
|
||||
|
4
features/steps/when/i_run_runner.rb
Normal file
4
features/steps/when/i_run_runner.rb
Normal file
@ -0,0 +1,4 @@
|
||||
When /^I run the runner$/ do
|
||||
@result = @runner.run
|
||||
end
|
||||
|
@ -1,2 +1,7 @@
|
||||
require 'jasmine-headless-webkit'
|
||||
|
||||
After do
|
||||
FileUtils.rm_f 'spec/report.txt'
|
||||
FileUtils.rm_f 'spec/runner.html'
|
||||
end
|
||||
|
||||
|
@ -72,8 +72,8 @@ module Jasmine::Headless
|
||||
def default_files
|
||||
%w{jasmine.js jasmine-html jasmine.css jasmine-extensions
|
||||
intense headless_reporter_result jasmine.HeadlessReporter
|
||||
jasmine.HeadlessFileReporter jasmine.HeadlessConsoleReporter
|
||||
jasmine.HeadlessTAPReporter
|
||||
jasmine.HeadlessReporter.File jasmine.HeadlessReporter.Console
|
||||
jasmine.HeadlessReporter.Tap
|
||||
jsDump beautify-html}
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ module Jasmine
|
||||
:enable_cache => true,
|
||||
:files => [],
|
||||
:reporters => [
|
||||
[ 'HeadlessConsoleReporter' ]
|
||||
[ 'Console' ]
|
||||
]
|
||||
}
|
||||
|
||||
@ -59,8 +59,8 @@ module Jasmine
|
||||
when '--report'
|
||||
warn REPORT_DEPRECATED_MESSAGE
|
||||
|
||||
add_reporter('HeadlessFileReporter', arg)
|
||||
add_reporter('HeadlessConsoleReporter')
|
||||
add_reporter('File', arg)
|
||||
add_reporter('Console')
|
||||
when '--runner-out'
|
||||
@options[:runner_output_filename] = arg
|
||||
when '--jasmine-config', '-j'
|
||||
|
@ -28,12 +28,13 @@ module Jasmine
|
||||
|
||||
class << self
|
||||
def run(options = {})
|
||||
options = Options.new(options) if !options.kind_of?(Options)
|
||||
new(options).run
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options)
|
||||
options = Options.new(options) if !options.kind_of?(Options)
|
||||
|
||||
@options = options
|
||||
end
|
||||
|
||||
|
@ -48,7 +48,7 @@ module Jasmine::Headless
|
||||
|
||||
def jhw_reporters
|
||||
reporters.collect do |reporter, output|
|
||||
%{jasmine.getEnv().addReporter(new jasmine.#{reporter}("#{output}"));}
|
||||
%{jasmine.getEnv().addReporter(new jasmine.HeadlessReporter.#{reporter}("#{output}"));}
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
require 'spec_helper'
|
||||
require 'tempfile'
|
||||
|
||||
describe "jasmine-headless-webkit" do
|
||||
let(:report) { 'spec/report.txt' }
|
||||
|
||||
before do
|
||||
FileUtils.rm_f report
|
||||
end
|
||||
|
||||
after do
|
||||
FileUtils.rm_f report
|
||||
end
|
||||
|
||||
describe 'files' do
|
||||
it 'should list all the files that will be found' do
|
||||
files = %x{bin/jasmine-headless-webkit -l -j spec/jasmine/success/success.yml}
|
||||
$?.exitstatus.should == 0
|
||||
|
||||
files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success.js\n"))
|
||||
files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success_spec.js\n"))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'runner-out' do
|
||||
it 'should write out the runner HTML to the specified path and not run the test' do
|
||||
runner_path = Tempfile.new('jhw')
|
||||
runner_path.close
|
||||
|
||||
system %{bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --runner-out #{runner_path.path}}
|
||||
|
||||
File.size(runner_path.path).should_not == 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,8 @@
|
||||
describe 'HeadlessReporterResult', ->
|
||||
|
||||
describe 'jasmine.HeadlessConsoleReporter', ->
|
||||
describe 'jasmine.HeadlessReporter', ->
|
||||
reporter = null
|
||||
|
||||
beforeEach ->
|
||||
reporter = new jasmine.HeadlessConsoleReporter()
|
||||
reporter = new jasmine.HeadlessReporter.Console()
|
||||
|
||||
describe '#formatResultLine', ->
|
||||
context 'length = 1', ->
|
@ -1,6 +1,6 @@
|
||||
describe 'jasmine.HeadlessTAPReporter', ->
|
||||
describe 'jasmine.HeadlessReporter.Tap', ->
|
||||
beforeEach ->
|
||||
@reporter = new jasmine.HeadlessTAPReporter()
|
||||
@reporter = new jasmine.HeadlessReporter.Tap()
|
||||
|
||||
describe '#reportRunnerResults', ->
|
||||
it 'should write nothing for nothing', ->
|
@ -15,9 +15,9 @@ describe Jasmine::Headless::FilesList do
|
||||
File.expand_path('vendor/assets/javascripts/intense.js'),
|
||||
File.expand_path('vendor/assets/javascripts/headless_reporter_result.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessReporter.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessFileReporter.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessTAPReporter.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessReporter.File.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js'),
|
||||
File.expand_path('vendor/assets/javascripts/jsDump.js'),
|
||||
File.expand_path('vendor/assets/javascripts/beautify-html.js'),
|
||||
]
|
||||
|
@ -56,7 +56,7 @@ describe Jasmine::Headless::Options do
|
||||
|
||||
options.process_option("--report", file)
|
||||
|
||||
options[:reporters].should == [ [ 'HeadlessFileReporter', file ], [ 'HeadlessConsoleReporter' ] ]
|
||||
options[:reporters].should == [ [ 'File', file ], [ 'Console' ] ]
|
||||
end
|
||||
end
|
||||
|
||||
@ -144,7 +144,7 @@ describe Jasmine::Headless::Options do
|
||||
|
||||
context 'no reporters' do
|
||||
it 'should have the default reporter' do
|
||||
options[:reporters].should == [ [ 'HeadlessConsoleReporter' ] ]
|
||||
options[:reporters].should == [ [ 'Console' ] ]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -93,45 +93,6 @@ describe Jasmine::Headless::Runner do
|
||||
end
|
||||
end
|
||||
|
||||
context 'real tests' do
|
||||
let(:report) { 'spec/report.txt' }
|
||||
|
||||
before do
|
||||
FileUtils.rm_f report
|
||||
end
|
||||
|
||||
after do
|
||||
FileUtils.rm_f report
|
||||
end
|
||||
|
||||
it 'should succeed with error code 0' do
|
||||
Jasmine::Headless::Runner.run(
|
||||
:jasmine_config => 'spec/jasmine/success/success.yml',
|
||||
:reporters => [
|
||||
[ 'HeadlessFileReporter', report ]
|
||||
]
|
||||
).should == 0
|
||||
|
||||
report.should be_a_report_containing(1, 0, false)
|
||||
end
|
||||
|
||||
it 'should succeed but with javascript error' do
|
||||
Jasmine::Headless::Runner.run(:jasmine_config => 'spec/jasmine/success_with_error/success_with_error.yml').should == 1
|
||||
end
|
||||
|
||||
it 'should fail on one test' do
|
||||
Jasmine::Headless::Runner.run(
|
||||
:jasmine_config => 'spec/jasmine/failure/failure.yml',
|
||||
:reporters => [
|
||||
[ 'HeadlessFileReporter', report ]
|
||||
]
|
||||
).should == 1
|
||||
|
||||
report.should be_a_report_containing(1, 1, false)
|
||||
report.should contain_a_failing_spec(['failure', 'should fail with error code of 1'])
|
||||
end
|
||||
end
|
||||
|
||||
describe '#runner_filename' do
|
||||
let(:runner_filename) { runner.runner_filename }
|
||||
let(:yaml_output) { 'yaml output' }
|
||||
|
@ -1,6 +1,6 @@
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
#
|
||||
class jasmine.HeadlessConsoleReporter extends jasmine.HeadlessReporter
|
||||
class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter
|
||||
constructor: (@callback = null) ->
|
||||
super(@callback)
|
||||
|
@ -1,4 +1,6 @@
|
||||
class jasmine.HeadlessFileReporter extends jasmine.HeadlessReporter
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
#
|
||||
class jasmine.HeadlessReporter.File extends jasmine.HeadlessReporter
|
||||
reportRunnerResults: (runner) ->
|
||||
super(runner)
|
||||
|
@ -1,4 +1,6 @@
|
||||
class jasmine.HeadlessTAPReporter extends jasmine.HeadlessReporter
|
||||
#= require jasmine.HeadlessReporter.js
|
||||
|
||||
class jasmine.HeadlessReporter.Tap extends jasmine.HeadlessReporter
|
||||
constructor: (@outputTarget = null) ->
|
||||
super(@outputTarget)
|
||||
|
35
vendor/assets/coffeescripts/prolog.coffee
vendored
35
vendor/assets/coffeescripts/prolog.coffee
vendored
@ -26,35 +26,41 @@ if window.JHW
|
||||
console.log(data)
|
||||
data
|
||||
|
||||
puts = (message) ->
|
||||
JHW.print('stdout', message + "\n")
|
||||
|
||||
# handle unloading
|
||||
window.onbeforeunload = (e) ->
|
||||
e = e || window.event
|
||||
|
||||
JHW.hasError()
|
||||
JHW.print('stdout', "The code tried to leave the test page. Check for unhandled form submits and link clicks.\n")
|
||||
puts "The code tried to leave the test page. Check for unhandled form submits and link clicks."
|
||||
|
||||
if e
|
||||
e.returnValue = 'string'
|
||||
e.returnValue = 'string' if e
|
||||
|
||||
return 'string'
|
||||
|
||||
window.confirm = (message) ->
|
||||
JHW.print('stdout', "#{"[confirm]".foreground('red')} jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.\n")
|
||||
true
|
||||
|
||||
window.alert = (message) ->
|
||||
JHW.print('stdout', "[alert] ".foreground('red') + message + "\n")
|
||||
|
||||
# script errors
|
||||
JHW._hasErrors = false
|
||||
JHW._handleError = (message, lineNumber, sourceURL) ->
|
||||
JHW.print('stderr', message + "\n")
|
||||
JHW._hasErrors = true
|
||||
false
|
||||
|
||||
JHW._setColors = (useColors) ->
|
||||
Intense.useColors = useColors
|
||||
# dialogs
|
||||
window.confirm = (message) ->
|
||||
puts "#{"[confirm]".foreground('red')} jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true."
|
||||
|
||||
true
|
||||
|
||||
window.alert = (message) ->
|
||||
puts "[alert] ".foreground('red') + message
|
||||
|
||||
# color support
|
||||
JHW._setColors = (useColors) -> Intense.useColors = useColors
|
||||
|
||||
# console.log support
|
||||
JHW._usedConsole = false
|
||||
|
||||
JHW.log = (msg) ->
|
||||
JHW.hasUsedConsole()
|
||||
|
||||
@ -62,7 +68,8 @@ if window.JHW
|
||||
reporter.consoleLogUsed(msg) if reporter.consoleLogUsed?
|
||||
|
||||
JHW._usedConsole = true
|
||||
JHW.print('stdout', msg + "\n")
|
||||
|
||||
puts msg
|
||||
|
||||
window.CoffeeScriptToFilename = {}
|
||||
window.CSTF = window.CoffeeScriptToFilename
|
||||
|
@ -1,21 +1,21 @@
|
||||
(function() {
|
||||
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessConsoleReporter = (function() {
|
||||
jasmine.HeadlessReporter.Console = (function() {
|
||||
|
||||
__extends(HeadlessConsoleReporter, jasmine.HeadlessReporter);
|
||||
__extends(Console, jasmine.HeadlessReporter);
|
||||
|
||||
function HeadlessConsoleReporter(callback) {
|
||||
function Console(callback) {
|
||||
this.callback = callback != null ? callback : null;
|
||||
this._waitRunner = __bind(this._waitRunner, this);
|
||||
HeadlessConsoleReporter.__super__.constructor.call(this, this.callback);
|
||||
Console.__super__.constructor.call(this, this.callback);
|
||||
this.position = 0;
|
||||
this.positions = "|/-\\";
|
||||
}
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportRunnerResults = function(runner) {
|
||||
Console.prototype.reportRunnerResults = function(runner) {
|
||||
var result, resultLine, _i, _len, _ref;
|
||||
HeadlessConsoleReporter.__super__.reportRunnerResults.call(this);
|
||||
Console.__super__.reportRunnerResults.call(this);
|
||||
this.print("\n");
|
||||
resultLine = this.formatResultLine(this._runtime());
|
||||
if (this.failedCount === 0) {
|
||||
@ -31,16 +31,16 @@
|
||||
return this.puts("\nTest ordering seed: --seed " + (JHW.getSeed()));
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
HeadlessConsoleReporter.__super__.reportRunnerStarting.call(this, runner);
|
||||
Console.prototype.reportRunnerStarting = function(runner) {
|
||||
Console.__super__.reportRunnerStarting.call(this, runner);
|
||||
if (!this.hasError()) {
|
||||
return this.puts("\nRunning Jasmine specs...".bright());
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSpecResults = function(spec) {
|
||||
Console.prototype.reportSpecResults = function(spec) {
|
||||
var _this = this;
|
||||
HeadlessConsoleReporter.__super__.reportSpecResults.call(this, spec);
|
||||
Console.__super__.reportSpecResults.call(this, spec);
|
||||
return this._reportSpecResult(spec, {
|
||||
success: function(results) {
|
||||
return _this.print('.'.foreground('green'));
|
||||
@ -66,7 +66,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSpecWaiting = function() {
|
||||
Console.prototype.reportSpecWaiting = function() {
|
||||
if (!this.timer) {
|
||||
this.timer = true;
|
||||
this.first = true;
|
||||
@ -74,7 +74,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.reportSpecRunning = function() {
|
||||
Console.prototype.reportSpecRunning = function() {
|
||||
if (this.timer) {
|
||||
clearTimeout(this.timer);
|
||||
this.timer = null;
|
||||
@ -82,7 +82,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype.formatResultLine = function(runtime) {
|
||||
Console.prototype.formatResultLine = function(runtime) {
|
||||
var line;
|
||||
line = [];
|
||||
line.push(this.length);
|
||||
@ -94,7 +94,7 @@
|
||||
return line.join(' ');
|
||||
};
|
||||
|
||||
HeadlessConsoleReporter.prototype._waitRunner = function() {
|
||||
Console.prototype._waitRunner = function() {
|
||||
var _this = this;
|
||||
return this.timer = setTimeout(function() {
|
||||
if (_this.timer) {
|
||||
@ -108,7 +108,7 @@
|
||||
}, 750);
|
||||
};
|
||||
|
||||
return HeadlessConsoleReporter;
|
||||
return Console;
|
||||
|
||||
})();
|
||||
|
@ -1,29 +1,29 @@
|
||||
(function() {
|
||||
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessFileReporter = (function() {
|
||||
jasmine.HeadlessReporter.File = (function() {
|
||||
|
||||
__extends(HeadlessFileReporter, jasmine.HeadlessReporter);
|
||||
__extends(File, jasmine.HeadlessReporter);
|
||||
|
||||
function HeadlessFileReporter() {
|
||||
HeadlessFileReporter.__super__.constructor.apply(this, arguments);
|
||||
function File() {
|
||||
File.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
HeadlessFileReporter.prototype.reportRunnerResults = function(runner) {
|
||||
File.prototype.reportRunnerResults = function(runner) {
|
||||
var output;
|
||||
HeadlessFileReporter.__super__.reportRunnerResults.call(this, runner);
|
||||
File.__super__.reportRunnerResults.call(this, runner);
|
||||
output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + (this._runtime()) + "||" + (JHW._hasErrors ? "T" : "F");
|
||||
this.puts(output);
|
||||
return this.puts("SEED||" + (JHW.getSeed()));
|
||||
};
|
||||
|
||||
HeadlessFileReporter.prototype.consoleLogUsed = function(msg) {
|
||||
File.prototype.consoleLogUsed = function(msg) {
|
||||
return this.puts("CONSOLE||" + msg);
|
||||
};
|
||||
|
||||
HeadlessFileReporter.prototype.reportSpecResults = function(spec) {
|
||||
File.prototype.reportSpecResults = function(spec) {
|
||||
var _this = this;
|
||||
HeadlessFileReporter.__super__.reportSpecResults.call(this, spec);
|
||||
File.__super__.reportSpecResults.call(this, spec);
|
||||
return this._reportSpecResult(spec, {
|
||||
success: function(results) {
|
||||
return _this.puts("PASS||" + spec.getJHWSpecInformation());
|
||||
@ -34,7 +34,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
return HeadlessFileReporter;
|
||||
return File;
|
||||
|
||||
})();
|
||||
|
@ -1,26 +1,26 @@
|
||||
(function() {
|
||||
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
|
||||
|
||||
jasmine.HeadlessTAPReporter = (function() {
|
||||
jasmine.HeadlessReporter.Tap = (function() {
|
||||
|
||||
__extends(HeadlessTAPReporter, jasmine.HeadlessReporter);
|
||||
__extends(Tap, jasmine.HeadlessReporter);
|
||||
|
||||
function HeadlessTAPReporter(outputTarget) {
|
||||
function Tap(outputTarget) {
|
||||
this.outputTarget = outputTarget != null ? outputTarget : null;
|
||||
HeadlessTAPReporter.__super__.constructor.call(this, this.outputTarget);
|
||||
Tap.__super__.constructor.call(this, this.outputTarget);
|
||||
this.output = [];
|
||||
}
|
||||
|
||||
HeadlessTAPReporter.prototype.reportRunnerResults = function(runner) {
|
||||
HeadlessTAPReporter.__super__.reportRunnerResults.call(this, runner);
|
||||
Tap.prototype.reportRunnerResults = function(runner) {
|
||||
Tap.__super__.reportRunnerResults.call(this, runner);
|
||||
if (this.output.length > 0) this.output.unshift("1.." + this.output.length);
|
||||
return this.puts(this.output.join("\n"));
|
||||
};
|
||||
|
||||
HeadlessTAPReporter.prototype.reportSpecResults = function(spec) {
|
||||
Tap.prototype.reportSpecResults = function(spec) {
|
||||
var description, index;
|
||||
var _this = this;
|
||||
HeadlessTAPReporter.__super__.reportSpecResults.call(this, spec);
|
||||
Tap.__super__.reportSpecResults.call(this, spec);
|
||||
index = this.output.length + 1;
|
||||
description = spec.getSpecSplitName().join(' ');
|
||||
return this._reportSpecResult(spec, {
|
||||
@ -33,7 +33,7 @@
|
||||
});
|
||||
};
|
||||
|
||||
return HeadlessTAPReporter;
|
||||
return Tap;
|
||||
|
||||
})();
|
||||
|
25
vendor/assets/javascripts/prolog.js
vendored
25
vendor/assets/javascripts/prolog.js
vendored
@ -1,3 +1,5 @@
|
||||
(function() {
|
||||
var puts;
|
||||
|
||||
if (window.JHW) {
|
||||
window.console = {
|
||||
@ -35,26 +37,29 @@
|
||||
return data;
|
||||
}
|
||||
};
|
||||
puts = function(message) {
|
||||
return JHW.print('stdout', message + "\n");
|
||||
};
|
||||
window.onbeforeunload = function(e) {
|
||||
e = e || window.event;
|
||||
JHW.hasError();
|
||||
JHW.print('stdout', "The code tried to leave the test page. Check for unhandled form submits and link clicks.\n");
|
||||
puts("The code tried to leave the test page. Check for unhandled form submits and link clicks.");
|
||||
if (e) e.returnValue = 'string';
|
||||
return 'string';
|
||||
};
|
||||
window.confirm = function(message) {
|
||||
JHW.print('stdout', "" + ("[confirm]".foreground('red')) + " jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.\n");
|
||||
return true;
|
||||
};
|
||||
window.alert = function(message) {
|
||||
return JHW.print('stdout', "[alert] ".foreground('red') + message + "\n");
|
||||
};
|
||||
JHW._hasErrors = false;
|
||||
JHW._handleError = function(message, lineNumber, sourceURL) {
|
||||
JHW.print('stderr', message + "\n");
|
||||
JHW._hasErrors = true;
|
||||
return false;
|
||||
};
|
||||
window.confirm = function(message) {
|
||||
puts("" + ("[confirm]".foreground('red')) + " jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.");
|
||||
return true;
|
||||
};
|
||||
window.alert = function(message) {
|
||||
return puts("[alert] ".foreground('red') + message);
|
||||
};
|
||||
JHW._setColors = function(useColors) {
|
||||
return Intense.useColors = useColors;
|
||||
};
|
||||
@ -68,10 +73,12 @@
|
||||
if (reporter.consoleLogUsed != null) reporter.consoleLogUsed(msg);
|
||||
}
|
||||
JHW._usedConsole = true;
|
||||
return JHW.print('stdout', msg + "\n");
|
||||
return puts(msg);
|
||||
};
|
||||
}
|
||||
|
||||
window.CoffeeScriptToFilename = {};
|
||||
|
||||
window.CSTF = window.CoffeeScriptToFilename;
|
||||
|
||||
}).call(this);
|
||||
|
Loading…
Reference in New Issue
Block a user