jasmine-headless-webkit 0.8.4 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/Gemfile +16 -8
  2. data/Guardfile +6 -1
  3. data/Rakefile +2 -1
  4. data/config/cucumber.yml +2 -0
  5. data/ext/jasmine-webkit-specrunner/Page.cpp +2 -3
  6. data/ext/jasmine-webkit-specrunner/Page.h +1 -0
  7. data/ext/jasmine-webkit-specrunner/Runner.cpp +37 -16
  8. data/ext/jasmine-webkit-specrunner/Runner.h +15 -5
  9. data/ext/jasmine-webkit-specrunner/specrunner.cpp +17 -7
  10. data/features/bin/failure.feature +7 -0
  11. data/features/bin/files.feature +7 -0
  12. data/features/bin/filtered_run/both_runs.feature +18 -0
  13. data/features/bin/filtered_run/no_full_run.feature +14 -0
  14. data/features/bin/help.feature +7 -0
  15. data/features/bin/quiet_messages.feature +8 -0
  16. data/features/bin/runner_out.feature +8 -0
  17. data/features/bin/spec_files_with_same_basename.feature +7 -0
  18. data/features/bin/success.feature +20 -0
  19. data/features/bin/success_with_js_error.feature +5 -0
  20. data/features/bin/tries_to_leave_page.feature +7 -0
  21. data/features/bin/try_to_click_a_button.feature +7 -0
  22. data/features/bin/two_files_from_src_files.feature +11 -0
  23. data/features/bin/with_coffeescript_error.feature +7 -0
  24. data/features/bin/with_console_log.feature +7 -0
  25. data/features/bin/with_server.feature +7 -0
  26. data/features/bin/with_window_prompt.feature +7 -0
  27. data/features/reporters.feature +24 -0
  28. data/features/runner.feature +34 -0
  29. data/features/steps/given/i_have_test_suite.rb +2 -0
  30. data/features/steps/given/no_existing_file.rb +4 -0
  31. data/features/steps/given/options/i_have_defaults.rb +4 -0
  32. data/features/steps/given/options/i_have_reporters.rb +10 -0
  33. data/features/steps/given/options/i_have_runner_options.rb +3 -0
  34. data/features/steps/then/bin/exit_status_should_be.rb +3 -0
  35. data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
  36. data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
  37. data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
  38. data/features/steps/then/bin/output_should_include.rb +3 -0
  39. data/features/steps/then/bin/output_should_not_include.rb +4 -0
  40. data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
  41. data/features/steps/then/reporting/report_should_exist.rb +3 -0
  42. data/features/steps/then/reporting/report_should_have.rb +7 -0
  43. data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
  44. data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
  45. data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
  46. data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
  47. data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
  48. data/features/steps/when/i_delete_file.rb +3 -0
  49. data/features/steps/when/i_get_runner.rb +4 -0
  50. data/features/steps/when/i_get_template_writer.rb +4 -0
  51. data/features/steps/when/i_run_executable.rb +4 -0
  52. data/features/steps/when/i_run_runner.rb +4 -0
  53. data/features/support/env.rb +7 -0
  54. data/lib/jasmine/headless/file_checker.rb +7 -3
  55. data/lib/jasmine/headless/files_list.rb +46 -19
  56. data/lib/jasmine/headless/options.rb +113 -5
  57. data/lib/jasmine/headless/report.rb +6 -1
  58. data/lib/jasmine/headless/report_message/console.rb +2 -4
  59. data/lib/jasmine/headless/report_message/seed.rb +14 -0
  60. data/lib/jasmine/headless/report_message/spec.rb +3 -5
  61. data/lib/jasmine/headless/report_message.rb +1 -0
  62. data/lib/jasmine/headless/runner.rb +169 -28
  63. data/lib/jasmine/headless/task.rb +0 -14
  64. data/lib/jasmine/headless/template_writer.rb +28 -4
  65. data/lib/jasmine/headless/unique_asset_list.rb +1 -1
  66. data/lib/jasmine/headless/version.rb +1 -1
  67. data/lib/jasmine/headless.rb +18 -0
  68. data/lib/jasmine-headless-webkit.rb +0 -4
  69. data/script/hooks/post-commit +4 -0
  70. data/script/hooks/pre-commit +2 -2
  71. data/script/initialize-environment +1 -1
  72. data/skel/template.html.erb +31 -2
  73. data/spec/jasmine/noisy/file.js.erb +0 -0
  74. data/spec/jasmine/noisy/noisy.yml +8 -0
  75. data/spec/jasmine/noisy/other_file.js +2 -0
  76. data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
  77. data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
  78. data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
  79. data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
  80. data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
  81. data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
  82. data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
  83. data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
  84. data/spec/jasmine/window_prompt/source.js +2 -0
  85. data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
  86. data/spec/javascripts/headless_reporter_result_spec.coffee +22 -6
  87. data/spec/javascripts/helpers/spec_helper.coffee +2 -0
  88. data/spec/javascripts/{jasmine.HeadlessConsoleReporter_spec.coffee → jasmine-extensions_spec.coffee} +0 -35
  89. data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
  90. data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
  91. data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
  92. data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
  93. data/spec/javascripts/support/jasmine.yml +6 -5
  94. data/spec/lib/jasmine/headless/file_checker_spec.rb +25 -9
  95. data/spec/lib/jasmine/headless/files_list_spec.rb +132 -158
  96. data/spec/lib/jasmine/headless/options_spec.rb +77 -0
  97. data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
  98. data/spec/lib/jasmine/headless/report_spec.rb +16 -0
  99. data/spec/lib/jasmine/headless/runner_spec.rb +110 -33
  100. data/spec/lib/jasmine/headless/template_writer_spec.rb +31 -27
  101. data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +3 -3
  102. data/spec/lib/jasmine/headless_spec.rb +36 -0
  103. data/spec/skel/template.html.erb_spec.rb +8 -0
  104. data/vendor/assets/coffeescripts/prolog.coffee +48 -21
  105. data/vendor/assets/javascripts/headless_reporter_result.js +3 -0
  106. data/vendor/assets/{coffeescripts → javascripts}/intense.coffee +0 -0
  107. data/vendor/assets/{coffeescripts → javascripts}/jasmine-extensions.coffee +4 -10
  108. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
  109. data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
  110. data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
  111. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
  112. data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
  113. data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
  114. data/vendor/assets/javascripts/prolog.js +44 -27
  115. metadata +157 -31
  116. data/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro +0 -19
  117. data/lib/digest/jasmine_test.rb +0 -20
  118. data/spec/bin/jasmine-headless-webkit_spec.rb +0 -142
  119. data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +0 -118
  120. data/vendor/assets/javascripts/intense.js +0 -44
  121. data/vendor/assets/javascripts/jasmine-extensions.js +0 -129
  122. data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +0 -136
@@ -1,142 +0,0 @@
1
- require 'spec_helper'
2
- require 'tempfile'
3
-
4
- describe "jasmine-headless-webkit" do
5
- let(:report) { 'spec/report.txt' }
6
-
7
- before do
8
- FileUtils.rm_f report
9
- end
10
-
11
- after do
12
- FileUtils.rm_f report
13
- end
14
-
15
- describe 'success' do
16
- it "should succeed with error code 0" do
17
- system %{bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --report #{report}}
18
- $?.exitstatus.should == 0
19
-
20
- report.should be_a_report_containing(1, 0, false)
21
- end
22
- end
23
-
24
-
25
- describe 'success but with js error' do
26
- it "should succeed with error code 0" do
27
- system %{bin/jasmine-headless-webkit -j spec/jasmine/success_with_error/success_with_error.yml --report #{report}}
28
- $?.exitstatus.should == 1
29
-
30
- # returns are unpredictable due to changes in jasmine! >.<
31
- # all we can do is ensure that we've actually failed
32
- #
33
- # report.should be_a_report_containing(0, 0, false)
34
- end
35
- end
36
-
37
- describe 'failure' do
38
- it "should fail with an error code of 1" do
39
- system %{bin/jasmine-headless-webkit -j spec/jasmine/failure/failure.yml --report #{report}}
40
- $?.exitstatus.should == 1
41
-
42
- report.should be_a_report_containing(1, 1, false)
43
- end
44
- end
45
-
46
- describe 'with console.log' do
47
- it "should succeed, but has a console.log so an error code of 2" do
48
- system %{bin/jasmine-headless-webkit -j spec/jasmine/console_log/console_log.yml --report #{report}}
49
- $?.exitstatus.should == 2
50
-
51
- report.should be_a_report_containing(1, 0, true)
52
- end
53
- end
54
-
55
- describe 'with coffeescript error' do
56
- it "should fail" do
57
- system %{bin/jasmine-headless-webkit -j spec/jasmine/coffeescript_error/coffeescript_error.yml --report #{report}}
58
- $?.exitstatus.should == 1
59
-
60
- File.exist?(report).should be_false
61
- end
62
- end
63
-
64
- describe 'tries to leave page' do
65
- it "should not leave the page nor loop" do
66
- system %{bin/jasmine-headless-webkit -j spec/jasmine/leave_page/leave_page.yml --report #{report}}
67
- $?.exitstatus.should == 1
68
- end
69
- end
70
-
71
- describe 'tries to click a button' do
72
- it "should not leave the page nor loop" do
73
- system %{bin/jasmine-headless-webkit -j spec/jasmine/click_button/click_button.yml --report #{report}}
74
- $?.exitstatus.should == 0
75
-
76
- report.should be_a_report_containing(0, 0, false)
77
- end
78
- end
79
-
80
- describe 'with filtered run' do
81
- context "don't run a full run, just the filtered run" do
82
- it "should succeed and run both" do
83
- system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --no-full-run --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
84
- $?.exitstatus.should == 0
85
-
86
- report.should be_a_report_containing(1, 0, false)
87
- end
88
-
89
- it "should use a file outside the normal test run and only run one" do
90
- system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success/success_other_file.js}
91
- $?.exitstatus.should == 0
92
-
93
- report.should be_a_report_containing(1, 0, false)
94
- end
95
- end
96
-
97
- context "do both runs" do
98
- it "should fail and not run the second" do
99
- system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_failure/filtered_failure.yml --report #{report} ./spec/jasmine/filtered_failure/failure_spec.js}
100
- $?.exitstatus.should == 1
101
-
102
- report.should be_a_report_containing(1, 1, false)
103
- end
104
-
105
- it "should succeed and run both" do
106
- system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success/success_one_spec.js}
107
- $?.exitstatus.should == 0
108
-
109
- report.should be_a_report_containing(2, 0, false)
110
- end
111
-
112
- it "should succeed and run both, with the first having a console.log call" do
113
- system %{bin/jasmine-headless-webkit -j spec/jasmine/filtered_success_with_console/filtered_success.yml --report #{report} ./spec/jasmine/filtered_success_with_console/success_one_spec.js}
114
- $?.exitstatus.should == 2
115
-
116
- report.should be_a_report_containing(2, 0, true)
117
- end
118
- end
119
- end
120
-
121
- describe 'files' do
122
- it 'should list all the files that will be found' do
123
- files = %x{bin/jasmine-headless-webkit -l -j spec/jasmine/success/success.yml}
124
- $?.exitstatus.should == 0
125
-
126
- files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success.js\n"))
127
- files.lines.to_a.should include(File.expand_path("./spec/jasmine/success/success_spec.js\n"))
128
- end
129
- end
130
-
131
- describe 'runner-out' do
132
- it 'should write out the runner HTML to the specified path and not run the test' do
133
- runner_path = Tempfile.new('jhw')
134
- runner_path.close
135
-
136
- system %{bin/jasmine-headless-webkit -j spec/jasmine/success/success.yml --runner-out #{runner_path.path}}
137
-
138
- File.size(runner_path.path).should_not == 0
139
- end
140
- end
141
- end
142
-
@@ -1,118 +0,0 @@
1
- if !jasmine?
2
- throw new Error("jasmine not loaded!")
3
-
4
- class jasmine.HeadlessConsoleReporter
5
- constructor: (@callback = null) ->
6
- @results = []
7
- @failedCount = 0
8
- @length = 0
9
- @timer = null
10
- @position = 0
11
- @positions = "|/-\\"
12
-
13
- reportRunnerResults: (runner) ->
14
- return if this.hasError()
15
-
16
- runtime = (new Date() - @startTime) / 1000.0
17
-
18
- JHW.stdout.print("\n")
19
-
20
- resultLine = this._formatResultLine(runtime)
21
-
22
- if @failedCount == 0
23
- JHW.stdout.puts("PASS: #{resultLine}".foreground('green'))
24
- else
25
- JHW.stdout.puts("FAIL: #{resultLine}".foreground('red'))
26
- JHW.hasSpecFailure()
27
-
28
- output = "TOTAL||#{@length}||#{@failedCount}||#{runtime}||#{if JHW._hasErrors then "T" else "F"}"
29
-
30
- JHW.report.puts(output)
31
-
32
- for result in @results
33
- JHW.stdout.puts(result.toString())
34
-
35
- if window.JHW
36
- window.onbeforeunload = null
37
-
38
- JHW.finishSuite()
39
-
40
- reportRunnerStarting: (runner) ->
41
- @startTime = new Date()
42
- JHW.stdout.puts("\nRunning Jasmine specs...".bright()) if !this.hasError()
43
-
44
- reportSpecResults: (spec) ->
45
- return if this.hasError()
46
- JHW.ping()
47
-
48
- results = spec.results()
49
-
50
- @length++
51
- if results.passed()
52
- JHW.stdout.print('.'.foreground('green'))
53
- JHW.report.puts("PASS||" + spec.getJHWSpecInformation())
54
- else
55
- JHW.stdout.print('F'.foreground('red'))
56
- JHW.report.puts("FAIL||" + spec.getJHWSpecInformation())
57
-
58
- @failedCount++
59
- failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName())
60
- testCount = 1
61
-
62
- for result in results.getItems()
63
- if result.type == 'expect' and !result.passed_
64
- if foundLine = result.expectations[testCount - 1]
65
- [ result.line, result.lineNumber ] = foundLine
66
- failureResult.addResult(result)
67
- testCount += 1
68
- @results.push(failureResult)
69
-
70
- reportSpecStarting: (spec) ->
71
- if this.hasError()
72
- spec.finish()
73
- spec.suite.finish()
74
-
75
- reportSpecWaiting: ->
76
- runner = null
77
-
78
- if !@timer
79
- @timer = true
80
- first = true
81
-
82
- runner = =>
83
- @timer = setTimeout(
84
- =>
85
- if @timer
86
- JHW.stdout.print(Intense.moveBack()) if !first
87
- JHW.stdout.print(@positions.substr(@position, 1).foreground('yellow'))
88
- @position += 1
89
- @position %= @positions.length
90
- first = false
91
- runner()
92
- , 750
93
- )
94
- runner()
95
-
96
- reportSpecRunning: ->
97
- if @timer
98
- clearTimeout(@timer)
99
- @timer = null
100
- JHW.stdout.print(Intense.moveBack())
101
-
102
- reportSuiteResults: (suite) ->
103
- hasError: ->
104
- JHW._hasErrors
105
-
106
- _formatResultLine: (runtime) ->
107
- line = []
108
- line.push(@length)
109
- line.push((if @length == 1 then "test" else "tests") + ',')
110
-
111
- line.push(@failedCount)
112
- line.push((if @failedCount == 1 then "failure" else "failures") + ',')
113
-
114
- line.push(runtime)
115
- line.push((if runtime == 1.0 then "sec" else "secs") + '.')
116
-
117
- line.join(' ')
118
-
@@ -1,44 +0,0 @@
1
- (function() {
2
- var code, method, _ref;
3
-
4
- window.Intense = {
5
- colors: {
6
- black: 0,
7
- red: 1,
8
- green: 2,
9
- yellow: 3,
10
- blue: 4,
11
- magenta: 5,
12
- cyan: 6,
13
- white: 7
14
- },
15
- methods: {
16
- foreground: function(color) {
17
- if (Intense.useColors) {
18
- return "\033[3" + Intense.colors[color] + "m" + this + "\033[0m";
19
- } else {
20
- return this;
21
- }
22
- },
23
- bright: function() {
24
- if (Intense.useColors) {
25
- return "\033[1m" + this + "\033[0m";
26
- } else {
27
- return this;
28
- }
29
- }
30
- },
31
- useColors: true,
32
- moveBack: function(count) {
33
- if (count == null) count = 1;
34
- return "\033[" + count + "D";
35
- }
36
- };
37
-
38
- _ref = Intense.methods;
39
- for (method in _ref) {
40
- code = _ref[method];
41
- String.prototype[method] = code;
42
- }
43
-
44
- }).call(this);
@@ -1,129 +0,0 @@
1
- (function() {
2
- var generator, getSplitName, method, pauseAndRun, _i, _len, _ref;
3
- var __slice = Array.prototype.slice;
4
-
5
- if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
6
- throw new Error("jasmine not laoded!");
7
- }
8
-
9
- if (window.JHW) {
10
- getSplitName = function(parts) {
11
- parts.push(String(this.description).replace(/[\n\r]/g, ' '));
12
- return parts;
13
- };
14
- jasmine.Suite.prototype.getSuiteSplitName = function() {
15
- return this.getSplitName(this.parentSuite ? this.parentSuite.getSuiteSplitName() : []);
16
- };
17
- jasmine.Spec.prototype.getSpecSplitName = function() {
18
- return this.getSplitName(this.suite.getSuiteSplitName());
19
- };
20
- jasmine.Suite.prototype.getSplitName = getSplitName;
21
- jasmine.Spec.prototype.getSplitName = getSplitName;
22
- jasmine.Spec.prototype.getJHWSpecInformation = function() {
23
- var parts, specLineInfo;
24
- parts = this.getSpecSplitName();
25
- specLineInfo = HeadlessReporterResult.findSpecLine(parts);
26
- if (specLineInfo.file) {
27
- parts.push("" + specLineInfo.file + ":" + specLineInfo.lineNumber);
28
- } else {
29
- parts.push('');
30
- }
31
- return parts.join("||");
32
- };
33
- jasmine.Spec.prototype.finishCallback = function() {
34
- JHW.ping();
35
- return this.env.reporter.reportSpecResults(this);
36
- };
37
- jasmine.Spec.prototype.fail = function(e) {
38
- var expectationResult, filename, realFilename;
39
- if (e && e.sourceURL && window.CoffeeScriptToFilename) {
40
- filename = e.sourceURL.split('/').pop();
41
- if (realFilename = window.CoffeeScriptToFilename[filename]) {
42
- e = {
43
- name: e.name,
44
- message: e.message,
45
- lineNumber: "~" + String(e.line),
46
- sourceURL: realFilename
47
- };
48
- }
49
- }
50
- expectationResult = new jasmine.ExpectationResult({
51
- passed: false,
52
- message: e ? jasmine.util.formatException(e) : 'Exception',
53
- trace: {
54
- stack: e.stack
55
- }
56
- });
57
- return this.results_.addResult(expectationResult);
58
- };
59
- jasmine.NestedResults.isValidSpecLine = function(line) {
60
- return line.match(/^\s*expect/) !== null || line.match(/^\s*return\s*expect/) !== null;
61
- };
62
- jasmine.NestedResults.parseFunction = function(func) {
63
- var line, lineCount, lines, _i, _len, _ref;
64
- lines = [];
65
- lineCount = 0;
66
- _ref = func.split("\n");
67
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
68
- line = _ref[_i];
69
- if (jasmine.NestedResults.isValidSpecLine(line)) {
70
- line = line.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^return\s*/, '');
71
- lines.push([line, lineCount]);
72
- }
73
- lineCount += 1;
74
- }
75
- return lines;
76
- };
77
- jasmine.NestedResults.parseAndStore = function(func) {
78
- if (!jasmine.NestedResults.ParsedFunctions[func]) {
79
- jasmine.NestedResults.ParsedFunctions[func] = jasmine.NestedResults.parseFunction(func);
80
- }
81
- return jasmine.NestedResults.ParsedFunctions[func];
82
- };
83
- jasmine.NestedResults.ParsedFunctions = [];
84
- if (!jasmine.WaitsBlock.prototype._execute) {
85
- jasmine.WaitsBlock.prototype._execute = jasmine.WaitsBlock.prototype.execute;
86
- jasmine.WaitsForBlock.prototype._execute = jasmine.WaitsForBlock.prototype.execute;
87
- pauseAndRun = function(onComplete) {
88
- JHW.timerPause();
89
- jasmine.getEnv().reporter.reportSpecWaiting();
90
- return this._execute(function() {
91
- jasmine.getEnv().reporter.reportSpecRunning();
92
- JHW.timerDone();
93
- return onComplete();
94
- });
95
- };
96
- jasmine.WaitsBlock.prototype.execute = pauseAndRun;
97
- jasmine.WaitsForBlock.prototype.execute = pauseAndRun;
98
- jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult;
99
- jasmine.NestedResults.prototype.addResult = function(result) {
100
- result.expectations = [];
101
- result.expectations = jasmine.NestedResults.parseAndStore(arguments.callee.caller.caller.caller.toString());
102
- return this.addResult_(result);
103
- };
104
- _ref = ["reportSpecWaiting", "reportSpecRunning"];
105
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
106
- method = _ref[_i];
107
- generator = function(method) {
108
- return function() {
109
- var args, reporter, _j, _len2, _ref2, _results;
110
- args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
111
- _ref2 = this.subReporters_;
112
- _results = [];
113
- for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
114
- reporter = _ref2[_j];
115
- if (reporter[method] != null) {
116
- _results.push(reporter[method].apply(reporter, args));
117
- } else {
118
- _results.push(void 0);
119
- }
120
- }
121
- return _results;
122
- };
123
- };
124
- jasmine.MultiReporter.prototype[method] = generator(method);
125
- }
126
- }
127
- }
128
-
129
- }).call(this);
@@ -1,136 +0,0 @@
1
-
2
- if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
3
- throw new Error("jasmine not loaded!");
4
- }
5
-
6
- jasmine.HeadlessConsoleReporter = (function() {
7
-
8
- function HeadlessConsoleReporter(callback) {
9
- this.callback = callback != null ? callback : null;
10
- this.results = [];
11
- this.failedCount = 0;
12
- this.length = 0;
13
- this.timer = null;
14
- this.position = 0;
15
- this.positions = "|/-\\";
16
- }
17
-
18
- HeadlessConsoleReporter.prototype.reportRunnerResults = function(runner) {
19
- var output, result, resultLine, runtime, _i, _len, _ref;
20
- if (this.hasError()) return;
21
- runtime = (new Date() - this.startTime) / 1000.0;
22
- JHW.stdout.print("\n");
23
- resultLine = this._formatResultLine(runtime);
24
- if (this.failedCount === 0) {
25
- JHW.stdout.puts(("PASS: " + resultLine).foreground('green'));
26
- } else {
27
- JHW.stdout.puts(("FAIL: " + resultLine).foreground('red'));
28
- JHW.hasSpecFailure();
29
- }
30
- output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + runtime + "||" + (JHW._hasErrors ? "T" : "F");
31
- JHW.report.puts(output);
32
- _ref = this.results;
33
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
34
- result = _ref[_i];
35
- JHW.stdout.puts(result.toString());
36
- }
37
- if (window.JHW) window.onbeforeunload = null;
38
- return JHW.finishSuite();
39
- };
40
-
41
- HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
42
- this.startTime = new Date();
43
- if (!this.hasError()) {
44
- return JHW.stdout.puts("\nRunning Jasmine specs...".bright());
45
- }
46
- };
47
-
48
- HeadlessConsoleReporter.prototype.reportSpecResults = function(spec) {
49
- var failureResult, foundLine, result, results, testCount, _i, _len, _ref;
50
- if (this.hasError()) return;
51
- JHW.ping();
52
- results = spec.results();
53
- this.length++;
54
- if (results.passed()) {
55
- JHW.stdout.print('.'.foreground('green'));
56
- return JHW.report.puts("PASS||" + spec.getJHWSpecInformation());
57
- } else {
58
- JHW.stdout.print('F'.foreground('red'));
59
- JHW.report.puts("FAIL||" + spec.getJHWSpecInformation());
60
- this.failedCount++;
61
- failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName());
62
- testCount = 1;
63
- _ref = results.getItems();
64
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
65
- result = _ref[_i];
66
- if (result.type === 'expect' && !result.passed_) {
67
- if (foundLine = result.expectations[testCount - 1]) {
68
- result.line = foundLine[0], result.lineNumber = foundLine[1];
69
- }
70
- failureResult.addResult(result);
71
- }
72
- testCount += 1;
73
- }
74
- return this.results.push(failureResult);
75
- }
76
- };
77
-
78
- HeadlessConsoleReporter.prototype.reportSpecStarting = function(spec) {
79
- if (this.hasError()) {
80
- spec.finish();
81
- return spec.suite.finish();
82
- }
83
- };
84
-
85
- HeadlessConsoleReporter.prototype.reportSpecWaiting = function() {
86
- var first, runner;
87
- var _this = this;
88
- runner = null;
89
- if (!this.timer) {
90
- this.timer = true;
91
- first = true;
92
- runner = function() {
93
- return _this.timer = setTimeout(function() {
94
- if (_this.timer) {
95
- if (!first) JHW.stdout.print(Intense.moveBack());
96
- JHW.stdout.print(_this.positions.substr(_this.position, 1).foreground('yellow'));
97
- _this.position += 1;
98
- _this.position %= _this.positions.length;
99
- first = false;
100
- return runner();
101
- }
102
- }, 750);
103
- };
104
- return runner();
105
- }
106
- };
107
-
108
- HeadlessConsoleReporter.prototype.reportSpecRunning = function() {
109
- if (this.timer) {
110
- clearTimeout(this.timer);
111
- this.timer = null;
112
- return JHW.stdout.print(Intense.moveBack());
113
- }
114
- };
115
-
116
- HeadlessConsoleReporter.prototype.reportSuiteResults = function(suite) {};
117
-
118
- HeadlessConsoleReporter.prototype.hasError = function() {
119
- return JHW._hasErrors;
120
- };
121
-
122
- HeadlessConsoleReporter.prototype._formatResultLine = function(runtime) {
123
- var line;
124
- line = [];
125
- line.push(this.length);
126
- line.push((this.length === 1 ? "test" : "tests") + ',');
127
- line.push(this.failedCount);
128
- line.push((this.failedCount === 1 ? "failure" : "failures") + ',');
129
- line.push(runtime);
130
- line.push((runtime === 1.0 ? "sec" : "secs") + '.');
131
- return line.join(' ');
132
- };
133
-
134
- return HeadlessConsoleReporter;
135
-
136
- })();