jasmine-headless-webkit 0.7.3.1 → 0.7.3.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.
Files changed (53) hide show
  1. data/Guardfile +3 -2
  2. data/bin/jasmine-headless-webkit +1 -1
  3. data/ext/jasmine-webkit-specrunner/Page.cpp +8 -21
  4. data/ext/jasmine-webkit-specrunner/Page.h +11 -15
  5. data/ext/jasmine-webkit-specrunner/Runner.cpp +86 -110
  6. data/ext/jasmine-webkit-specrunner/Runner.h +23 -26
  7. data/ext/jasmine-webkit-specrunner/common.pri +2 -2
  8. data/ext/jasmine-webkit-specrunner/specrunner.cpp +0 -1
  9. data/ext/jasmine-webkit-specrunner/specrunner.pro +1 -0
  10. data/lib/jasmine/files_list.rb +24 -24
  11. data/lib/jasmine/headless.rb +1 -1
  12. data/lib/jasmine/headless/spec_file_analyzer.rb +1 -1
  13. data/lib/jasmine/headless/version.rb +1 -1
  14. data/lib/qt/qmake.rb +1 -5
  15. data/skel/template.html.erb +8 -45
  16. data/spec/files/UTF-8-test.txt +0 -0
  17. data/spec/javascripts/headless_reporter_result_spec.coffee +14 -0
  18. data/spec/javascripts/{jasmine.headless-reporter_spec.coffee → jasmine.HeadlessConsoleReporter_spec.coffee} +2 -2
  19. data/spec/javascripts/support/jasmine.yml +1 -1
  20. data/spec/lib/jasmine/files_list_spec.rb +6 -3
  21. data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +41 -30
  22. data/spec/lib/qt/qmake_spec.rb +0 -6
  23. data/vendor/assets/coffeescripts/headless_reporter_result.coffee +46 -0
  24. data/vendor/assets/coffeescripts/intense.coffee +27 -0
  25. data/{jasmine/jasmine.headless-reporter.coffee → vendor/assets/coffeescripts/jasmine-extensions.coffee} +5 -90
  26. data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +86 -0
  27. data/vendor/assets/coffeescripts/prolog.coffee +73 -0
  28. data/{js-lib → vendor/assets/javascripts}/beautify-html.js +0 -0
  29. data/vendor/assets/javascripts/headless_reporter_result.js +72 -0
  30. data/vendor/assets/javascripts/intense.js +37 -0
  31. data/vendor/assets/javascripts/jasmine-extensions.js +101 -0
  32. data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +96 -0
  33. data/{js-lib → vendor/assets/javascripts}/jsDump.js +0 -0
  34. data/vendor/assets/javascripts/prolog.js +89 -0
  35. metadata +28 -33
  36. data/dev-bin/hooks/pre-commit +0 -5
  37. data/dev-bin/install-hooks +0 -6
  38. data/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +0 -149
  39. data/ext/jasmine-webkit-specrunner/ConsoleOutput.h +0 -39
  40. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp +0 -129
  41. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h +0 -32
  42. data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro +0 -7
  43. data/ext/jasmine-webkit-specrunner/Page_test.cpp +0 -43
  44. data/ext/jasmine-webkit-specrunner/Page_test.h +0 -27
  45. data/ext/jasmine-webkit-specrunner/Page_test.pro +0 -6
  46. data/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp +0 -54
  47. data/ext/jasmine-webkit-specrunner/ReportFileOutput.h +0 -37
  48. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp +0 -88
  49. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h +0 -26
  50. data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro +0 -7
  51. data/ext/jasmine-webkit-specrunner/test.pri +0 -3
  52. data/ext/jasmine-webkit-specrunner/test.rb +0 -31
  53. data/jasmine/jasmine.headless-reporter.js +0 -231
@@ -0,0 +1,96 @@
1
+ (function() {
2
+ if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
3
+ throw new Error("jasmine not loaded!");
4
+ }
5
+ jasmine.HeadlessConsoleReporter = (function() {
6
+ function HeadlessConsoleReporter(callback) {
7
+ this.callback = callback != null ? callback : null;
8
+ this.results = [];
9
+ this.failedCount = 0;
10
+ this.length = 0;
11
+ }
12
+ HeadlessConsoleReporter.prototype.reportRunnerResults = function(runner) {
13
+ var output, result, resultLine, runtime, _i, _len, _ref;
14
+ if (this.hasError()) {
15
+ return;
16
+ }
17
+ runtime = (new Date() - this.startTime) / 1000.0;
18
+ JHW.stdout.print("\n");
19
+ resultLine = this._formatResultLine(runtime);
20
+ if (this.failedCount === 0) {
21
+ JHW.stdout.puts(("PASS: " + resultLine).foreground('green'));
22
+ } else {
23
+ JHW.stdout.puts(("FAIL: " + resultLine).foreground('red'));
24
+ JHW.hasSpecFailure();
25
+ }
26
+ output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + runtime + "||" + (JHW._hasErrors ? "T" : "F");
27
+ JHW.report.puts(output);
28
+ _ref = this.results;
29
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
30
+ result = _ref[_i];
31
+ result.print();
32
+ }
33
+ if (window.JHW) {
34
+ window.onbeforeunload = null;
35
+ }
36
+ return JHW.finishSuite();
37
+ };
38
+ HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
39
+ this.startTime = new Date();
40
+ return JHW.stdout.puts("\nRunning Jasmine specs...".bright());
41
+ };
42
+ HeadlessConsoleReporter.prototype.reportSpecResults = function(spec) {
43
+ var failureResult, foundLine, result, results, testCount, _i, _len, _ref;
44
+ if (this.hasError()) {
45
+ return;
46
+ }
47
+ JHW.ping();
48
+ results = spec.results();
49
+ this.length++;
50
+ if (results.passed()) {
51
+ JHW.stdout.print('.'.foreground('green'));
52
+ return JHW.report.puts("PASS||" + spec.getJHWSpecInformation());
53
+ } else {
54
+ JHW.stdout.print('F'.foreground('red'));
55
+ JHW.report.puts("FAIL||" + spec.getJHWSpecInformation());
56
+ this.failedCount++;
57
+ failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName());
58
+ testCount = 1;
59
+ _ref = results.getItems();
60
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
61
+ result = _ref[_i];
62
+ if (result.type === 'expect' && !result.passed_) {
63
+ if (foundLine = result.expectations[testCount - 1]) {
64
+ result.line = foundLine[0], result.lineNumber = foundLine[1];
65
+ }
66
+ failureResult.addResult(result);
67
+ }
68
+ testCount += 1;
69
+ }
70
+ return this.results.push(failureResult);
71
+ }
72
+ };
73
+ HeadlessConsoleReporter.prototype.reportSpecStarting = function(spec) {
74
+ if (this.hasError()) {
75
+ spec.finish();
76
+ return spec.suite.finish();
77
+ }
78
+ };
79
+ HeadlessConsoleReporter.prototype.reportSuiteResults = function(suite) {};
80
+ HeadlessConsoleReporter.prototype.hasError = function() {
81
+ return JHW._hasErrors;
82
+ };
83
+ HeadlessConsoleReporter.prototype._formatResultLine = function(runtime) {
84
+ var line;
85
+ line = [];
86
+ line.push(this.length);
87
+ line.push((this.length === 1 ? "test" : "tests") + ',');
88
+ line.push(this.failedCount);
89
+ line.push((this.failedCount === 1 ? "failure" : "failures") + ',');
90
+ line.push(runtime);
91
+ line.push((runtime === 1.0 ? "sec" : "secs") + '.');
92
+ return line.join(' ');
93
+ };
94
+ return HeadlessConsoleReporter;
95
+ })();
96
+ }).call(this);
File without changes
@@ -0,0 +1,89 @@
1
+ (function() {
2
+ var createHandle, handle, _i, _len, _ref;
3
+ if (window.JHW) {
4
+ window.console = {
5
+ log: function(data) {
6
+ var dump, useJsDump;
7
+ if (typeof jQuery !== 'undefined' && data instanceof jQuery) {
8
+ return JHW.log(style_html($("<div />").append(data).html(), {
9
+ indent_size: 2
10
+ }));
11
+ } else {
12
+ useJsDump = true;
13
+ try {
14
+ if (typeof data.toJSON === 'function') {
15
+ JHW.log("JSON: " + (JSON.stringify(data, null, 2)));
16
+ useJsDump = false;
17
+ }
18
+ } catch (e) {
19
+
20
+ }
21
+ if (useJsDump) {
22
+ dump = jsDump.doParse(data);
23
+ if (dump.indexOf("\n") === -1) {
24
+ return JHW.log(dump);
25
+ } else {
26
+ return JHW.log("jsDump: " + dump);
27
+ }
28
+ }
29
+ }
30
+ },
31
+ pp: function(data) {
32
+ return JHW.log(jasmine ? jasmine.pp(data) : console.log(data));
33
+ },
34
+ peek: function(data) {
35
+ console.log(data);
36
+ return data;
37
+ }
38
+ };
39
+ window.onbeforeunload = function(e) {
40
+ e = e || window.event;
41
+ JHW.hasError();
42
+ JHW.stdout.puts('The code tried to leave the test page. Check for unhandled form submits and link clicks.');
43
+ if (e) {
44
+ e.returnValue = 'string';
45
+ }
46
+ return 'string';
47
+ };
48
+ window.confirm = function(message) {
49
+ JHW.stderr.puts("" + ("[confirm]".foreground('red')) + " jasmine-headless-webkit can't handle confirm() yet! You should mock window.confirm. Returning true.");
50
+ return true;
51
+ };
52
+ window.alert = function(message) {
53
+ return JHW.stderr.puts("[alert] ".foreground('red') + message);
54
+ };
55
+ JHW._hasErrors = false;
56
+ JHW._handleError = function(message, lineNumber, sourceURL) {
57
+ JHW.stderr.puts(message);
58
+ JHW._hasErrors = true;
59
+ return false;
60
+ };
61
+ JHW._setColors = function(useColors) {
62
+ return Intense.useColors = useColors;
63
+ };
64
+ createHandle = function(handle) {
65
+ return JHW[handle] = {
66
+ print: function(content) {
67
+ return JHW.print(handle, content);
68
+ },
69
+ puts: function(content) {
70
+ return JHW.print(handle, content + "\n");
71
+ }
72
+ };
73
+ };
74
+ _ref = ['stdout', 'stderr', 'report'];
75
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
76
+ handle = _ref[_i];
77
+ createHandle(handle);
78
+ }
79
+ JHW._usedConsole = false;
80
+ JHW.log = function(msg) {
81
+ JHW.hasUsedConsole();
82
+ JHW.report.puts("CONSOLE||" + msg);
83
+ JHW._usedConsole = true;
84
+ return JHW.stdout.puts(msg);
85
+ };
86
+ }
87
+ window.CoffeeScriptToFilename = {};
88
+ window.CSTF = window.CoffeeScriptToFilename;
89
+ }).call(this);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-headless-webkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3.1
4
+ version: 0.7.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-11-06 00:00:00.000000000Z
14
+ date: 2011-11-21 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jasmine-core
18
- requirement: &2155137140 !ruby/object:Gem::Requirement
18
+ requirement: &2165562680 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 1.1.beta
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2155137140
26
+ version_requirements: *2165562680
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-script
29
- requirement: &2155136360 !ruby/object:Gem::Requirement
29
+ requirement: &2165562180 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '2.2'
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2155136360
37
+ version_requirements: *2165562180
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: rainbow
40
- requirement: &2155135840 !ruby/object:Gem::Requirement
40
+ requirement: &2165561800 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2155135840
48
+ version_requirements: *2165561800
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: multi_json
51
- requirement: &2155135380 !ruby/object:Gem::Requirement
51
+ requirement: &2165561340 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,7 +56,7 @@ dependencies:
56
56
  version: '0'
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *2155135380
59
+ version_requirements: *2165561340
60
60
  description: Run Jasmine specs headlessly
61
61
  email:
62
62
  - john@coswellproductions.com
@@ -74,25 +74,10 @@ files:
74
74
  - README.md
75
75
  - Rakefile
76
76
  - bin/jasmine-headless-webkit
77
- - dev-bin/hooks/pre-commit
78
- - dev-bin/install-hooks
79
- - ext/jasmine-webkit-specrunner/ConsoleOutput.cpp
80
- - ext/jasmine-webkit-specrunner/ConsoleOutput.h
81
- - ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp
82
- - ext/jasmine-webkit-specrunner/ConsoleOutput_test.h
83
- - ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro
84
77
  - ext/jasmine-webkit-specrunner/Info.plist
85
78
  - ext/jasmine-webkit-specrunner/Makefile.dummy
86
79
  - ext/jasmine-webkit-specrunner/Page.cpp
87
80
  - ext/jasmine-webkit-specrunner/Page.h
88
- - ext/jasmine-webkit-specrunner/Page_test.cpp
89
- - ext/jasmine-webkit-specrunner/Page_test.h
90
- - ext/jasmine-webkit-specrunner/Page_test.pro
91
- - ext/jasmine-webkit-specrunner/ReportFileOutput.cpp
92
- - ext/jasmine-webkit-specrunner/ReportFileOutput.h
93
- - ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp
94
- - ext/jasmine-webkit-specrunner/ReportFileOutput_test.h
95
- - ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro
96
81
  - ext/jasmine-webkit-specrunner/Runner.cpp
97
82
  - ext/jasmine-webkit-specrunner/Runner.h
98
83
  - ext/jasmine-webkit-specrunner/common.pri
@@ -100,13 +85,7 @@ files:
100
85
  - ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro
101
86
  - ext/jasmine-webkit-specrunner/specrunner.cpp
102
87
  - ext/jasmine-webkit-specrunner/specrunner.pro
103
- - ext/jasmine-webkit-specrunner/test.pri
104
- - ext/jasmine-webkit-specrunner/test.rb
105
88
  - jasmine-headless-webkit.gemspec
106
- - jasmine/jasmine.headless-reporter.coffee
107
- - jasmine/jasmine.headless-reporter.js
108
- - js-lib/beautify-html.js
109
- - js-lib/jsDump.js
110
89
  - lib/autotest/discover.rb
111
90
  - lib/autotest/jasmine.rb
112
91
  - lib/autotest/jasmine_mixin.rb
@@ -139,6 +118,7 @@ files:
139
118
  - script/install-git-hooks
140
119
  - skel/template.html.erb
141
120
  - spec/bin/jasmine-headless-webkit_spec.rb
121
+ - spec/files/UTF-8-test.txt
142
122
  - spec/jasmine/click_button/click_button.js
143
123
  - spec/jasmine/click_button/click_button.yml
144
124
  - spec/jasmine/click_button/click_button_spec.js
@@ -173,7 +153,8 @@ files:
173
153
  - spec/jasmine/success_with_error/success_with_error.js
174
154
  - spec/jasmine/success_with_error/success_with_error.yml
175
155
  - spec/jasmine/success_with_error/success_with_error_spec.js
176
- - spec/javascripts/jasmine.headless-reporter_spec.coffee
156
+ - spec/javascripts/headless_reporter_result_spec.coffee
157
+ - spec/javascripts/jasmine.HeadlessConsoleReporter_spec.coffee
177
158
  - spec/javascripts/support/jasmine.yml
178
159
  - spec/javascripts/support/jquery-1.6.2.min.js
179
160
  - spec/lib/jasmine/files_list_spec.rb
@@ -188,6 +169,18 @@ files:
188
169
  - spec/lib/jasmine/headless/template_writer_spec.rb
189
170
  - spec/lib/qt/qmake_spec.rb
190
171
  - spec/spec_helper.rb
172
+ - vendor/assets/coffeescripts/headless_reporter_result.coffee
173
+ - vendor/assets/coffeescripts/intense.coffee
174
+ - vendor/assets/coffeescripts/jasmine-extensions.coffee
175
+ - vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee
176
+ - vendor/assets/coffeescripts/prolog.coffee
177
+ - vendor/assets/javascripts/beautify-html.js
178
+ - vendor/assets/javascripts/headless_reporter_result.js
179
+ - vendor/assets/javascripts/intense.js
180
+ - vendor/assets/javascripts/jasmine-extensions.js
181
+ - vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js
182
+ - vendor/assets/javascripts/jsDump.js
183
+ - vendor/assets/javascripts/prolog.js
191
184
  homepage: ''
192
185
  licenses: []
193
186
  post_install_message:
@@ -214,6 +207,7 @@ specification_version: 3
214
207
  summary: Run Jasmine specs headlessly in a WebKit browser
215
208
  test_files:
216
209
  - spec/bin/jasmine-headless-webkit_spec.rb
210
+ - spec/files/UTF-8-test.txt
217
211
  - spec/jasmine/click_button/click_button.js
218
212
  - spec/jasmine/click_button/click_button.yml
219
213
  - spec/jasmine/click_button/click_button_spec.js
@@ -248,7 +242,8 @@ test_files:
248
242
  - spec/jasmine/success_with_error/success_with_error.js
249
243
  - spec/jasmine/success_with_error/success_with_error.yml
250
244
  - spec/jasmine/success_with_error/success_with_error_spec.js
251
- - spec/javascripts/jasmine.headless-reporter_spec.coffee
245
+ - spec/javascripts/headless_reporter_result_spec.coffee
246
+ - spec/javascripts/jasmine.HeadlessConsoleReporter_spec.coffee
252
247
  - spec/javascripts/support/jasmine.yml
253
248
  - spec/javascripts/support/jquery-1.6.2.min.js
254
249
  - spec/lib/jasmine/files_list_spec.rb
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
-
3
- bundle exec rake
4
- if [ $? -ne 0 ]; then exit 1; fi
5
-
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- for i in $PWD/dev-bin/hooks/*; do
4
- ln -sf $i .git/hooks/${i##*/}
5
- done
6
-
@@ -1,149 +0,0 @@
1
- #include "ConsoleOutput.h"
2
-
3
- ConsoleOutput::ConsoleOutput() : QObject(),
4
- showColors(false),
5
- consoleLogUsed(false) {
6
- outputIO = &std::cout;
7
- }
8
-
9
- void ConsoleOutput::passed(const QString &specDetail) {
10
- green();
11
- *outputIO << '.';
12
- clear();
13
- outputIO->flush();
14
-
15
- consoleLogUsed = false;
16
- successes.push(specDetail);
17
- }
18
-
19
- void ConsoleOutput::failed(const QString &specDetail) {
20
- red();
21
- *outputIO << 'F';
22
- clear();
23
- outputIO->flush();
24
-
25
- consoleLogUsed = false;
26
- failures.push(specDetail);
27
- }
28
-
29
- void ConsoleOutput::green() {
30
- if (showColors) std::cout << "\033[0;32m";
31
- }
32
-
33
- void ConsoleOutput::clear() {
34
- if (showColors) std::cout << "\033[m";
35
- }
36
-
37
- void ConsoleOutput::red() {
38
- if (showColors) std::cout << "\033[0;31m";
39
- }
40
-
41
- void ConsoleOutput::yellow()
42
- {
43
- if (showColors) std::cout << "\033[0;33m";
44
- }
45
-
46
- void ConsoleOutput::errorLog(const QString &msg, int lineNumber, const QString &sourceID) {
47
- red();
48
- *outputIO << "[error] ";
49
- clear();
50
- *outputIO << qPrintable(sourceID) << ":" << lineNumber << " : " << qPrintable(msg);
51
- *outputIO << std::endl;
52
- }
53
-
54
- void ConsoleOutput::internalLog(const QString &note, const QString &msg) {
55
- red();
56
- *outputIO << "[" << qPrintable(note) << "] ";
57
- clear();
58
- *outputIO << qPrintable(msg);
59
- *outputIO << std::endl;
60
- }
61
-
62
- void ConsoleOutput::consoleLog(const QString &msg) {
63
- if (!consoleLogUsed) {
64
- *outputIO << std::endl;
65
- consoleLogUsed = true;
66
- }
67
-
68
- green();
69
- *outputIO << "[console] ";
70
- if (msg.contains("\n"))
71
- *outputIO << std::endl;
72
- clear();
73
- *outputIO << qPrintable(msg);
74
- *outputIO << std::endl;
75
- }
76
-
77
- void ConsoleOutput::logSpecFilename(const QString &name) {
78
- *outputIO << std::endl << std::endl;
79
- red();
80
- *outputIO << qPrintable(name) << std::endl;
81
- clear();
82
- }
83
-
84
- void ConsoleOutput::logSpecResult(const QString &result) {
85
- QStringList lines = result.split("\n");
86
- QStringListIterator linesIterator(lines);
87
-
88
- red();
89
- while (linesIterator.hasNext()) {
90
- QString line = linesIterator.next();
91
- if (!linesIterator.hasNext())
92
- yellow();
93
- *outputIO << " " << qPrintable(line) << std::endl;
94
- }
95
-
96
- clear();
97
- }
98
-
99
- void ConsoleOutput::reportFailure(const QString &totalTests, const QString &failedTests, const QString &duration) {
100
- red();
101
- *outputIO << std::endl << "FAIL: ";
102
- formatTestResults(totalTests, failedTests, duration);
103
- *outputIO << std::endl;
104
- clear();
105
- }
106
-
107
- void ConsoleOutput::reportSuccess(const QString &totalTests, const QString &failedTests, const QString &duration) {
108
- green();
109
- *outputIO << std::endl << "PASS: ";
110
- formatTestResults(totalTests, failedTests, duration);
111
- *outputIO << std::endl;
112
- clear();
113
- }
114
-
115
- void ConsoleOutput::reportSuccessWithJSErrors(const QString &totalTests, const QString &failedTests, const QString &duration) {
116
- yellow();
117
- *outputIO << std::endl << "PASS with JS errors: ";
118
- formatTestResults(totalTests, failedTests, duration);
119
- *outputIO << std::endl;
120
- clear();
121
- }
122
-
123
- void ConsoleOutput::formatTestResults(const QString &totalTests, const QString &failedTests, const QString &duration) {
124
- *outputIO << qPrintable(totalTests) << " ";
125
- if (totalTests == "1") {
126
- *outputIO << "test";
127
- } else {
128
- *outputIO << "tests";
129
- }
130
-
131
- *outputIO << ", ";
132
-
133
- *outputIO << qPrintable(failedTests) << " ";
134
- if (failedTests == "1") {
135
- *outputIO << "failure";
136
- } else {
137
- *outputIO << "failures";
138
- }
139
-
140
- *outputIO << ", ";
141
-
142
- *outputIO << qPrintable(duration) << " ";
143
- if (duration == "1") {
144
- *outputIO << "sec.";
145
- } else {
146
- *outputIO << "secs.";
147
- }
148
- }
149
-