jasmine-headless-webkit-firstbanco 0.9.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +89 -0
- data/Gemfile +30 -0
- data/Guardfile +41 -0
- data/README.md +44 -0
- data/Rakefile +65 -0
- data/bin/jasmine-headless-webkit +11 -0
- data/config/cucumber.yml +2 -0
- data/ext/jasmine-webkit-specrunner/Info.plist +22 -0
- data/ext/jasmine-webkit-specrunner/Makefile.dummy +5 -0
- data/ext/jasmine-webkit-specrunner/Page.cpp +15 -0
- data/ext/jasmine-webkit-specrunner/Page.h +20 -0
- data/ext/jasmine-webkit-specrunner/Runner.cpp +208 -0
- data/ext/jasmine-webkit-specrunner/Runner.h +73 -0
- data/ext/jasmine-webkit-specrunner/common.pri +8 -0
- data/ext/jasmine-webkit-specrunner/extconf.rb +10 -0
- data/ext/jasmine-webkit-specrunner/specrunner.cpp +79 -0
- data/ext/jasmine-webkit-specrunner/specrunner.pro +5 -0
- data/features/bin/failure.feature +7 -0
- data/features/bin/files.feature +7 -0
- data/features/bin/filtered_run/both_runs.feature +18 -0
- data/features/bin/filtered_run/no_full_run.feature +14 -0
- data/features/bin/help.feature +7 -0
- data/features/bin/quiet_messages.feature +8 -0
- data/features/bin/runner_out.feature +8 -0
- data/features/bin/spec_files_with_same_basename.feature +7 -0
- data/features/bin/success.feature +20 -0
- data/features/bin/success_with_js_error.feature +5 -0
- data/features/bin/tries_to_leave_page.feature +7 -0
- data/features/bin/try_to_click_a_button.feature +7 -0
- data/features/bin/two_files_from_src_files.feature +11 -0
- data/features/bin/with_coffeescript_error.feature +7 -0
- data/features/bin/with_console_log.feature +7 -0
- data/features/bin/with_server.feature +7 -0
- data/features/bin/with_window_prompt.feature +7 -0
- data/features/reporters.feature +24 -0
- data/features/runner.feature +34 -0
- data/features/steps/given/i_have_test_suite.rb +2 -0
- data/features/steps/given/no_existing_file.rb +4 -0
- data/features/steps/given/options/i_have_defaults.rb +4 -0
- data/features/steps/given/options/i_have_reporters.rb +10 -0
- data/features/steps/given/options/i_have_runner_options.rb +3 -0
- data/features/steps/then/bin/exit_status_should_be.rb +3 -0
- data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
- data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
- data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
- data/features/steps/then/bin/output_should_include.rb +3 -0
- data/features/steps/then/bin/output_should_not_include.rb +4 -0
- data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
- data/features/steps/then/reporting/report_should_exist.rb +3 -0
- data/features/steps/then/reporting/report_should_have.rb +7 -0
- data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
- data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
- data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
- data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
- data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
- data/features/steps/when/i_delete_file.rb +3 -0
- data/features/steps/when/i_get_runner.rb +4 -0
- data/features/steps/when/i_get_template_writer.rb +4 -0
- data/features/steps/when/i_run_executable.rb +4 -0
- data/features/steps/when/i_run_runner.rb +4 -0
- data/features/support/env.rb +7 -0
- data/jasmine-headless-webkit-firstbanco.gemspec +30 -0
- data/lib/autotest/discover.rb +1 -0
- data/lib/autotest/jasmine.rb +7 -0
- data/lib/autotest/jasmine_mixin.rb +111 -0
- data/lib/autotest/jasmine_rspec2.rb +7 -0
- data/lib/jasmine-headless-webkit.rb +3 -0
- data/lib/jasmine/headless.rb +61 -0
- data/lib/jasmine/headless/cacheable_action.rb +85 -0
- data/lib/jasmine/headless/coffee_script_cache.rb +20 -0
- data/lib/jasmine/headless/coffee_template.rb +36 -0
- data/lib/jasmine/headless/command_line.rb +31 -0
- data/lib/jasmine/headless/css_template.rb +19 -0
- data/lib/jasmine/headless/errors.rb +16 -0
- data/lib/jasmine/headless/file_checker.rb +25 -0
- data/lib/jasmine/headless/files_list.rb +332 -0
- data/lib/jasmine/headless/js_template.rb +23 -0
- data/lib/jasmine/headless/jst_template.rb +15 -0
- data/lib/jasmine/headless/nil_template.rb +14 -0
- data/lib/jasmine/headless/options.rb +206 -0
- data/lib/jasmine/headless/railtie.rb +12 -0
- data/lib/jasmine/headless/report.rb +81 -0
- data/lib/jasmine/headless/report_message.rb +12 -0
- data/lib/jasmine/headless/report_message/console.rb +18 -0
- data/lib/jasmine/headless/report_message/error.rb +20 -0
- data/lib/jasmine/headless/report_message/fail.rb +5 -0
- data/lib/jasmine/headless/report_message/pass.rb +5 -0
- data/lib/jasmine/headless/report_message/seed.rb +14 -0
- data/lib/jasmine/headless/report_message/spec.rb +28 -0
- data/lib/jasmine/headless/report_message/total.rb +31 -0
- data/lib/jasmine/headless/runner.rb +264 -0
- data/lib/jasmine/headless/spec_file_analyzer.rb +44 -0
- data/lib/jasmine/headless/task.rb +39 -0
- data/lib/jasmine/headless/template_writer.rb +65 -0
- data/lib/jasmine/headless/unique_asset_list.rb +16 -0
- data/lib/jasmine/headless/version.rb +5 -0
- data/lib/qt/qmake.rb +155 -0
- data/script/gemfile +11 -0
- data/script/hooks/post-commit +4 -0
- data/script/hooks/pre-commit +15 -0
- data/script/initialize-environment +35 -0
- data/script/install-git-hooks +6 -0
- data/skel/template.html.erb +77 -0
- data/spec/files/UTF-8-test.txt +0 -0
- data/spec/integration/randomization_spec.rb +13 -0
- data/spec/integration/specify_runner_file_spec.rb +22 -0
- data/spec/integration/sprockets_spec.rb +23 -0
- data/spec/jasmine/click_button/click_button.js +5 -0
- data/spec/jasmine/click_button/click_button.yml +12 -0
- data/spec/jasmine/click_button/click_button_spec.js +11 -0
- data/spec/jasmine/coffeescript_error/coffeescript_error.yml +10 -0
- data/spec/jasmine/coffeescript_error/spec.coffee +2 -0
- data/spec/jasmine/coffeescript_error/src.coffee +2 -0
- data/spec/jasmine/console_log/console_log.js +1 -0
- data/spec/jasmine/console_log/console_log.yml +10 -0
- data/spec/jasmine/console_log/console_log_spec.js +7 -0
- data/spec/jasmine/failure/failure.js +1 -0
- data/spec/jasmine/failure/failure.yml +9 -0
- data/spec/jasmine/failure/failure_spec.js +6 -0
- data/spec/jasmine/filtered_failure/failure_spec.js +6 -0
- data/spec/jasmine/filtered_failure/filtered_failure.yml +10 -0
- data/spec/jasmine/filtered_failure/src.js +0 -0
- data/spec/jasmine/filtered_failure/success_spec.js +6 -0
- data/spec/jasmine/filtered_success/filtered_success.yml +10 -0
- data/spec/jasmine/filtered_success/src.js +0 -0
- data/spec/jasmine/filtered_success/success_one_spec.js +6 -0
- data/spec/jasmine/filtered_success/success_other_file.js +7 -0
- data/spec/jasmine/filtered_success/success_two_spec.js +6 -0
- data/spec/jasmine/filtered_success_with_console/filtered_success.yml +10 -0
- data/spec/jasmine/filtered_success_with_console/src.js +0 -0
- data/spec/jasmine/filtered_success_with_console/success_one_spec.js +7 -0
- data/spec/jasmine/filtered_success_with_console/success_two_spec.js +6 -0
- data/spec/jasmine/leave_page/leave_page.js +4 -0
- data/spec/jasmine/leave_page/leave_page.yml +9 -0
- data/spec/jasmine/leave_page/leave_page_spec.js +11 -0
- data/spec/jasmine/noisy/file.js.erb +0 -0
- data/spec/jasmine/noisy/noisy.yml +8 -0
- data/spec/jasmine/noisy/other_file.js +2 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/jasmine.yml +11 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/test.js +2 -0
- data/spec/jasmine/runner_out_in_jasmine_yml/test_spec.coffee +4 -0
- data/spec/jasmine/success/success.js +1 -0
- data/spec/jasmine/success/success.yml +9 -0
- data/spec/jasmine/success/success_spec.js +6 -0
- data/spec/jasmine/success_with_error/success_with_error.js +3 -0
- data/spec/jasmine/success_with_error/success_with_error.yml +9 -0
- data/spec/jasmine/success_with_error/success_with_error_spec.js +6 -0
- data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
- data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
- data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
- data/spec/jasmine/window_prompt/source.js +2 -0
- data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
- data/spec/jasmine/with_sprockets_includes/assets/application.js.erb +2 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/code.js +6 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/jquery.string.js +0 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/required.js +3 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/subcode/more_code.js +2 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/templates/that.jst.ejs +1 -0
- data/spec/jasmine/with_sprockets_includes/assets/things/templates/this.jst +2 -0
- data/spec/jasmine/with_sprockets_includes/spec/spec_helper.js +1 -0
- data/spec/jasmine/with_sprockets_includes/spec/things/code_spec.js +9 -0
- data/spec/jasmine/with_sprockets_includes/with_sprockets_includes.yml +12 -0
- data/spec/javascripts/console.log_spec.coffee +15 -0
- data/spec/javascripts/headless_reporter_result_spec.coffee +30 -0
- data/spec/javascripts/helpers/spec_helper.coffee +2 -0
- data/spec/javascripts/jasmine-extensions_spec.coffee +80 -0
- data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
- data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
- data/spec/javascripts/support/jasmine.yml +9 -0
- data/spec/lib/jasmine/headless/cacheable_action_spec.rb +122 -0
- data/spec/lib/jasmine/headless/coffee_script_cache_spec.rb +21 -0
- data/spec/lib/jasmine/headless/coffee_template_spec.rb +55 -0
- data/spec/lib/jasmine/headless/css_template_spec.rb +25 -0
- data/spec/lib/jasmine/headless/file_checker_spec.rb +41 -0
- data/spec/lib/jasmine/headless/files_list_spec.rb +194 -0
- data/spec/lib/jasmine/headless/js_template_spec.rb +31 -0
- data/spec/lib/jasmine/headless/jst_template_spec.rb +21 -0
- data/spec/lib/jasmine/headless/nil_template_spec.rb +31 -0
- data/spec/lib/jasmine/headless/options_spec.rb +194 -0
- data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
- data/spec/lib/jasmine/headless/report_message/spec_spec.rb +20 -0
- data/spec/lib/jasmine/headless/report_spec.rb +95 -0
- data/spec/lib/jasmine/headless/runner_spec.rb +247 -0
- data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +68 -0
- data/spec/lib/jasmine/headless/task_spec.rb +92 -0
- data/spec/lib/jasmine/headless/template_writer_spec.rb +92 -0
- data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +22 -0
- data/spec/lib/jasmine/headless_spec.rb +38 -0
- data/spec/lib/qt/qmake_spec.rb +142 -0
- data/spec/skel/template.html.erb_spec.rb +8 -0
- data/spec/spec_helper.rb +113 -0
- data/vendor/assets/coffeescripts/headless_reporter_result.coffee +49 -0
- data/vendor/assets/coffeescripts/prolog.coffee +100 -0
- data/vendor/assets/javascripts/beautify-html.js +463 -0
- data/vendor/assets/javascripts/headless_reporter_result.js +79 -0
- data/vendor/assets/javascripts/intense.coffee +28 -0
- data/vendor/assets/javascripts/jasmine-extensions.coffee +97 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
- data/vendor/assets/javascripts/jsDump.js +209 -0
- data/vendor/assets/javascripts/prolog.js +108 -0
- metadata +347 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
window.HeadlessReporterResult = (function() {
|
4
|
+
|
5
|
+
function HeadlessReporterResult(name, splitName) {
|
6
|
+
this.name = name;
|
7
|
+
this.splitName = splitName;
|
8
|
+
this.results = [];
|
9
|
+
}
|
10
|
+
|
11
|
+
HeadlessReporterResult.prototype.addResult = function(message) {
|
12
|
+
return this.results.push(message);
|
13
|
+
};
|
14
|
+
|
15
|
+
HeadlessReporterResult.prototype.toString = function() {
|
16
|
+
var bestChoice, line, output, result, _i, _len, _ref;
|
17
|
+
output = "\n" + this.name.foreground('red');
|
18
|
+
bestChoice = HeadlessReporterResult.findSpecLine(this.splitName);
|
19
|
+
if (bestChoice.file) {
|
20
|
+
output += (" (" + bestChoice.file + ":" + bestChoice.lineNumber + ")").foreground('blue');
|
21
|
+
}
|
22
|
+
_ref = this.results;
|
23
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
24
|
+
result = _ref[_i];
|
25
|
+
line = result.message.foreground('red');
|
26
|
+
if (result.lineNumber) {
|
27
|
+
line += (" (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")").foreground('red').bright();
|
28
|
+
}
|
29
|
+
output += "\n " + line;
|
30
|
+
if (result.line != null) {
|
31
|
+
output += ("\n " + result.line).foreground('yellow');
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return output;
|
35
|
+
};
|
36
|
+
|
37
|
+
HeadlessReporterResult.findSpecLine = function(splitName) {
|
38
|
+
var bestChoice, file, index, lastLine, line, lineNumber, lines, newLineNumberInfo, _i, _len, _ref;
|
39
|
+
bestChoice = {
|
40
|
+
accuracy: 0,
|
41
|
+
file: null,
|
42
|
+
lineNumber: null
|
43
|
+
};
|
44
|
+
_ref = HeadlessReporterResult.specLineNumbers;
|
45
|
+
for (file in _ref) {
|
46
|
+
lines = _ref[file];
|
47
|
+
index = 0;
|
48
|
+
lineNumber = 0;
|
49
|
+
while (newLineNumberInfo = lines[splitName[index]]) {
|
50
|
+
if (newLineNumberInfo.length === 0) {
|
51
|
+
lineNumber = newLineNumberInfo[0];
|
52
|
+
} else {
|
53
|
+
lastLine = null;
|
54
|
+
for (_i = 0, _len = newLineNumberInfo.length; _i < _len; _i++) {
|
55
|
+
line = newLineNumberInfo[_i];
|
56
|
+
lastLine = line;
|
57
|
+
if (line > lineNumber) break;
|
58
|
+
}
|
59
|
+
lineNumber = lastLine;
|
60
|
+
}
|
61
|
+
index++;
|
62
|
+
}
|
63
|
+
if (index > bestChoice.accuracy) {
|
64
|
+
bestChoice = {
|
65
|
+
accuracy: index,
|
66
|
+
file: file,
|
67
|
+
lineNumber: lineNumber
|
68
|
+
};
|
69
|
+
}
|
70
|
+
if (index === splitName.length) break;
|
71
|
+
}
|
72
|
+
return bestChoice;
|
73
|
+
};
|
74
|
+
|
75
|
+
return HeadlessReporterResult;
|
76
|
+
|
77
|
+
})();
|
78
|
+
|
79
|
+
}).call(this);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
window.Intense = {
|
2
|
+
colors:
|
3
|
+
black: 0
|
4
|
+
red: 1
|
5
|
+
green: 2
|
6
|
+
yellow: 3
|
7
|
+
blue: 4
|
8
|
+
magenta: 5
|
9
|
+
cyan: 6
|
10
|
+
white: 7
|
11
|
+
methods:
|
12
|
+
foreground: (color) ->
|
13
|
+
if Intense.useColors
|
14
|
+
'\x1b' + "[3#{Intense.colors[color]}m#{this}" + '\x1b' + "[0m"
|
15
|
+
else
|
16
|
+
this
|
17
|
+
bright: ->
|
18
|
+
if Intense.useColors
|
19
|
+
'\x1b' + "[1m#{this}" + '\x1b' + "[0m"
|
20
|
+
else
|
21
|
+
this
|
22
|
+
useColors: true
|
23
|
+
moveBack: (count = 1) -> '\x1b' + "[#{count}D"
|
24
|
+
}
|
25
|
+
|
26
|
+
for method, code of Intense.methods
|
27
|
+
String.prototype[method] = code
|
28
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
if !jasmine?
|
2
|
+
throw new Error("jasmine not laoded!")
|
3
|
+
|
4
|
+
if window.JHW
|
5
|
+
# Jasmine extensions
|
6
|
+
getSplitName = (parts) ->
|
7
|
+
parts.push(String(@description).replace(/[\n\r]/g, ' '))
|
8
|
+
parts
|
9
|
+
|
10
|
+
jasmine.Suite.prototype.getSuiteSplitName = ->
|
11
|
+
this.getSplitName(if @parentSuite then @parentSuite.getSuiteSplitName() else [])
|
12
|
+
|
13
|
+
jasmine.Spec.prototype.getSpecSplitName = ->
|
14
|
+
this.getSplitName(@suite.getSuiteSplitName())
|
15
|
+
|
16
|
+
jasmine.Suite.prototype.getSplitName = getSplitName
|
17
|
+
jasmine.Spec.prototype.getSplitName = getSplitName
|
18
|
+
|
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.finishCallback = ->
|
29
|
+
JHW.ping()
|
30
|
+
this.env.reporter.reportSpecResults(this)
|
31
|
+
|
32
|
+
jasmine.Spec.prototype.fail = (e) ->
|
33
|
+
e = JHW.createCoffeeScriptFileException(e)
|
34
|
+
|
35
|
+
expectationResult = new jasmine.ExpectationResult({
|
36
|
+
passed: false,
|
37
|
+
message: if e then jasmine.util.formatException(e) else 'Exception',
|
38
|
+
trace: { stack: e.stack }
|
39
|
+
})
|
40
|
+
@results_.addResult(expectationResult)
|
41
|
+
|
42
|
+
this.env.reporter.reportException(e)
|
43
|
+
|
44
|
+
jasmine.NestedResults.isValidSpecLine = (line) ->
|
45
|
+
line.match(/^\s*expect/) != null || line.match(/^\s*return\s*expect/) != null
|
46
|
+
|
47
|
+
jasmine.NestedResults.parseFunction = (func) ->
|
48
|
+
lines = []
|
49
|
+
lineCount = 0
|
50
|
+
for line in func.split("\n")
|
51
|
+
if jasmine.NestedResults.isValidSpecLine(line)
|
52
|
+
line = line.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^return\s*/, '')
|
53
|
+
lines.push([line, lineCount])
|
54
|
+
lineCount += 1
|
55
|
+
lines
|
56
|
+
|
57
|
+
jasmine.NestedResults.parseAndStore = (func) ->
|
58
|
+
if !jasmine.NestedResults.ParsedFunctions[func]
|
59
|
+
jasmine.NestedResults.ParsedFunctions[func] = jasmine.NestedResults.parseFunction(func)
|
60
|
+
jasmine.NestedResults.ParsedFunctions[func]
|
61
|
+
|
62
|
+
jasmine.NestedResults.ParsedFunctions = []
|
63
|
+
|
64
|
+
if !jasmine.WaitsBlock.prototype._execute
|
65
|
+
jasmine.WaitsBlock.prototype._execute = jasmine.WaitsBlock.prototype.execute
|
66
|
+
jasmine.WaitsForBlock.prototype._execute = jasmine.WaitsForBlock.prototype.execute
|
67
|
+
|
68
|
+
pauseAndRun = (onComplete) ->
|
69
|
+
JHW.timerPause()
|
70
|
+
jasmine.getEnv().reporter.reportSpecWaiting()
|
71
|
+
|
72
|
+
this._execute ->
|
73
|
+
jasmine.getEnv().reporter.reportSpecRunning()
|
74
|
+
JHW.timerDone()
|
75
|
+
onComplete()
|
76
|
+
|
77
|
+
jasmine.WaitsBlock.prototype.execute = pauseAndRun
|
78
|
+
jasmine.WaitsForBlock.prototype.execute = pauseAndRun
|
79
|
+
|
80
|
+
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult
|
81
|
+
jasmine.NestedResults.prototype.addResult = (result) ->
|
82
|
+
result.expectations = []
|
83
|
+
# always three up?
|
84
|
+
|
85
|
+
result.expectations = jasmine.NestedResults.parseAndStore(arguments.callee.caller.caller.caller.toString())
|
86
|
+
|
87
|
+
this.addResult_(result)
|
88
|
+
|
89
|
+
for method in [ "reportSpecWaiting", "reportSpecRunning", "reportException" ]
|
90
|
+
generator = (method) ->
|
91
|
+
(args...) ->
|
92
|
+
for reporter in @subReporters_
|
93
|
+
if reporter[method]?
|
94
|
+
reporter[method](args...)
|
95
|
+
|
96
|
+
jasmine.MultiReporter.prototype[method] = generator(method)
|
97
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#= require jasmine.HeadlessReporter.ConsoleBase
|
2
|
+
#
|
3
|
+
class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter.ConsoleBase
|
4
|
+
displaySuccess: (spec) =>
|
5
|
+
this.print('.'.foreground('green'))
|
6
|
+
|
7
|
+
displayFailure: (spec) =>
|
8
|
+
this.print('F'.foreground('red'))
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#= require jasmine.HeadlessReporter
|
2
|
+
|
3
|
+
class jasmine.HeadlessReporter.ConsoleBase extends jasmine.HeadlessReporter
|
4
|
+
constructor: (@callback = null) ->
|
5
|
+
super(@callback)
|
6
|
+
|
7
|
+
@position = 0
|
8
|
+
@positions = "|/-\\"
|
9
|
+
|
10
|
+
formatResultLine: (runtime) ->
|
11
|
+
line = []
|
12
|
+
line.push(@length)
|
13
|
+
line.push((if @length == 1 then "test" else "tests") + ',')
|
14
|
+
|
15
|
+
line.push(@failedCount)
|
16
|
+
line.push((if @failedCount == 1 then "failure" else "failures") + ',')
|
17
|
+
|
18
|
+
line.push(runtime)
|
19
|
+
line.push((if runtime == 1.0 then "sec" else "secs") + '.')
|
20
|
+
|
21
|
+
line.join(' ')
|
22
|
+
|
23
|
+
reportRunnerResults: (runner) ->
|
24
|
+
super()
|
25
|
+
|
26
|
+
this.print("\n")
|
27
|
+
|
28
|
+
resultLine = this.formatResultLine(this._runtime())
|
29
|
+
|
30
|
+
if @failedCount == 0
|
31
|
+
this.puts("PASS: #{resultLine}".foreground('green'))
|
32
|
+
else
|
33
|
+
this.puts("FAIL: #{resultLine}".foreground('red'))
|
34
|
+
|
35
|
+
for result in @results
|
36
|
+
this.puts(result.toString())
|
37
|
+
|
38
|
+
this.puts("\nTest ordering seed: --seed #{JHW.getSeed()}")
|
39
|
+
|
40
|
+
reportRunnerStarting: (runner) ->
|
41
|
+
super(runner)
|
42
|
+
this.puts("\nRunning Jasmine specs...".bright()) if !this.hasError()
|
43
|
+
|
44
|
+
reportSpecWaiting: ->
|
45
|
+
if !@timer
|
46
|
+
@timer = true
|
47
|
+
@first = true
|
48
|
+
|
49
|
+
this._waitRunner()
|
50
|
+
|
51
|
+
reportSpecRunning: ->
|
52
|
+
if @timer
|
53
|
+
clearTimeout(@timer)
|
54
|
+
@timer = null
|
55
|
+
this.print(Intense.moveBack())
|
56
|
+
|
57
|
+
reportSpecResults: (spec) ->
|
58
|
+
super(spec)
|
59
|
+
|
60
|
+
this._reportSpecResult(spec, {
|
61
|
+
success: (results) =>
|
62
|
+
this.displaySuccess(spec)
|
63
|
+
failure: (results) =>
|
64
|
+
this.displayFailure(spec)
|
65
|
+
|
66
|
+
this.reportFailureResult(results, new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()))
|
67
|
+
})
|
68
|
+
|
69
|
+
reportFailureResult: (results, failureResult) ->
|
70
|
+
testCount = 1
|
71
|
+
|
72
|
+
for result in results.getItems()
|
73
|
+
if result.type == 'expect' and !result.passed_
|
74
|
+
if foundLine = result.expectations[testCount - 1]
|
75
|
+
[ result.line, result.lineNumber ] = foundLine
|
76
|
+
failureResult.addResult(result)
|
77
|
+
testCount += 1
|
78
|
+
@results.push(failureResult)
|
79
|
+
|
80
|
+
_waitRunner: =>
|
81
|
+
@timer = setTimeout(
|
82
|
+
=>
|
83
|
+
if @timer
|
84
|
+
this.print(Intense.moveBack()) if !@first
|
85
|
+
this.print(@positions.substr(@position, 1).foreground('yellow'))
|
86
|
+
@position += 1
|
87
|
+
@position %= @positions.length
|
88
|
+
@first = false
|
89
|
+
this._waitRunner()
|
90
|
+
, 750
|
91
|
+
)
|
92
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#= require jasmine.HeadlessReporter
|
2
|
+
#
|
3
|
+
class jasmine.HeadlessReporter.File extends jasmine.HeadlessReporter
|
4
|
+
reportRunnerResults: (runner) ->
|
5
|
+
super(runner)
|
6
|
+
|
7
|
+
output = "TOTAL||#{@length}||#{@failedCount}||#{this._runtime()}||#{if JHW._hasErrors then "T" else "F"}"
|
8
|
+
|
9
|
+
this.puts(output)
|
10
|
+
this.puts("SEED||#{JHW.getSeed()}")
|
11
|
+
|
12
|
+
consoleLogUsed: (msg) ->
|
13
|
+
this.puts("CONSOLE||#{msg}")
|
14
|
+
|
15
|
+
reportSpecResults: (spec) ->
|
16
|
+
super(spec)
|
17
|
+
|
18
|
+
this._reportSpecResult(spec, {
|
19
|
+
success: (results) =>
|
20
|
+
this.puts("PASS||" + spec.getJHWSpecInformation())
|
21
|
+
failure: (results) =>
|
22
|
+
this.puts("FAIL||" + spec.getJHWSpecInformation())
|
23
|
+
})
|
24
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#= require jasmine.HeadlessReporter
|
2
|
+
|
3
|
+
class jasmine.HeadlessReporter.Tap extends jasmine.HeadlessReporter
|
4
|
+
constructor: (@outputTarget = null) ->
|
5
|
+
super(@outputTarget)
|
6
|
+
|
7
|
+
@output = []
|
8
|
+
|
9
|
+
reportRunnerResults: (runner) ->
|
10
|
+
super(runner)
|
11
|
+
|
12
|
+
@output.unshift("1..#{@output.length}") if @output.length > 0
|
13
|
+
|
14
|
+
this.puts(@output.join("\n"))
|
15
|
+
|
16
|
+
reportSpecResults: (spec) ->
|
17
|
+
super(spec)
|
18
|
+
|
19
|
+
index = @output.length + 1
|
20
|
+
description = spec.getSpecSplitName().join(' ')
|
21
|
+
|
22
|
+
this._reportSpecResult(spec, {
|
23
|
+
success: (results) =>
|
24
|
+
@output.push("ok #{index} #{description}")
|
25
|
+
failure: (results) =>
|
26
|
+
@output.push("not ok #{index} #{description}")
|
27
|
+
})
|
28
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#= require jasmine.HeadlessReporter.ConsoleBase
|
2
|
+
#
|
3
|
+
class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase
|
4
|
+
@prereport = false
|
5
|
+
|
6
|
+
displaySuccess: (spec) =>
|
7
|
+
this.displaySpec(spec, 'green')
|
8
|
+
|
9
|
+
displayFailure: (spec) =>
|
10
|
+
this.displaySpec(spec, 'red')
|
11
|
+
|
12
|
+
displaySpec: (spec, color) =>
|
13
|
+
currentLastNames = (@lastNames || []).slice(0)
|
14
|
+
@lastNames = spec.getSpecSplitName()
|
15
|
+
|
16
|
+
for line in this.indentSpec(@lastNames, currentLastNames, color)
|
17
|
+
if line? and !_.isEmpty(line)
|
18
|
+
this.puts(line)
|
19
|
+
|
20
|
+
indentSpec: (current, last, color) =>
|
21
|
+
last = last.slice(0)
|
22
|
+
|
23
|
+
lines = []
|
24
|
+
|
25
|
+
for name in current
|
26
|
+
if last.shift() != name
|
27
|
+
lines.push(name)
|
28
|
+
else
|
29
|
+
lines.push(null)
|
30
|
+
|
31
|
+
this.indentLines(lines, color)
|
32
|
+
|
33
|
+
indentLines: (lines, color) =>
|
34
|
+
indent = ''
|
35
|
+
|
36
|
+
output = []
|
37
|
+
|
38
|
+
for line in lines
|
39
|
+
if line?
|
40
|
+
outputLine = indent
|
41
|
+
outputLine += this.colorLine(line, color)
|
42
|
+
|
43
|
+
output.push(outputLine)
|
44
|
+
indent += ' '
|
45
|
+
|
46
|
+
output
|
47
|
+
|
48
|
+
colorLine: (line, color) =>
|
49
|
+
line.foreground(color)
|
50
|
+
|
51
|
+
reportSpecStarting: (spec) =>
|
52
|
+
if jasmine.HeadlessReporter.Verbose.prereport
|
53
|
+
this.puts(spec.getSpecSplitName().join(' '))
|
54
|
+
|
55
|
+
reportException: (e) =>
|
56
|
+
e = JHW.createCoffeeScriptFileException(e)
|
57
|
+
|
58
|
+
if e.sourceURL && e.lineNumber
|
59
|
+
output = "#{e.sourceURL}:#{e.lineNumber} #{e.message}"
|
60
|
+
else
|
61
|
+
output = e.message ? e
|
62
|
+
|
63
|
+
this.puts(output.foreground('yellow'))
|
64
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
if !jasmine?
|
2
|
+
throw new Error("jasmine not loaded!")
|
3
|
+
|
4
|
+
class jasmine.HeadlessReporter
|
5
|
+
constructor: (@outputTarget = null) ->
|
6
|
+
@results = []
|
7
|
+
@failedCount = 0
|
8
|
+
@length = 0
|
9
|
+
@timer = null
|
10
|
+
|
11
|
+
hasError: ->
|
12
|
+
JHW._hasErrors
|
13
|
+
|
14
|
+
reportSpecStarting: (spec) ->
|
15
|
+
if this.hasError()
|
16
|
+
spec.finish()
|
17
|
+
spec.suite.finish()
|
18
|
+
|
19
|
+
reportSuiteResults: (suite) ->
|
20
|
+
|
21
|
+
reportRunnerStarting: (runner) ->
|
22
|
+
@startTime = new Date()
|
23
|
+
|
24
|
+
reportRunnerResults: (runner) ->
|
25
|
+
return if this.hasError()
|
26
|
+
|
27
|
+
if @failedCount != 0
|
28
|
+
JHW.hasSpecFailure()
|
29
|
+
|
30
|
+
JHW.finishSuite()
|
31
|
+
|
32
|
+
if window.JHW
|
33
|
+
window.onbeforeunload = null
|
34
|
+
|
35
|
+
reportSpecResults: (spec) ->
|
36
|
+
return if this.hasError()
|
37
|
+
JHW.ping()
|
38
|
+
|
39
|
+
_reportSpecResult: (spec, options) ->
|
40
|
+
results = spec.results()
|
41
|
+
|
42
|
+
@length++
|
43
|
+
|
44
|
+
if results.passed()
|
45
|
+
options.success(results, spec)
|
46
|
+
else
|
47
|
+
@failedCount++
|
48
|
+
options.failure(results, spec)
|
49
|
+
|
50
|
+
_runtime: ->
|
51
|
+
(new Date() - @startTime) / 1000.0
|
52
|
+
|
53
|
+
print: (output) =>
|
54
|
+
JHW.print(@outputTarget, output)
|
55
|
+
|
56
|
+
puts: (output) =>
|
57
|
+
JHW.print(@outputTarget, output + "\n")
|
58
|
+
|