jasmine-headless-webkit 0.7.3.1 → 0.7.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Guardfile +3 -2
- data/bin/jasmine-headless-webkit +1 -1
- data/ext/jasmine-webkit-specrunner/Page.cpp +8 -21
- data/ext/jasmine-webkit-specrunner/Page.h +11 -15
- data/ext/jasmine-webkit-specrunner/Runner.cpp +86 -110
- data/ext/jasmine-webkit-specrunner/Runner.h +23 -26
- data/ext/jasmine-webkit-specrunner/common.pri +2 -2
- data/ext/jasmine-webkit-specrunner/specrunner.cpp +0 -1
- data/ext/jasmine-webkit-specrunner/specrunner.pro +1 -0
- data/lib/jasmine/files_list.rb +24 -24
- data/lib/jasmine/headless.rb +1 -1
- data/lib/jasmine/headless/spec_file_analyzer.rb +1 -1
- data/lib/jasmine/headless/version.rb +1 -1
- data/lib/qt/qmake.rb +1 -5
- data/skel/template.html.erb +8 -45
- data/spec/files/UTF-8-test.txt +0 -0
- data/spec/javascripts/headless_reporter_result_spec.coffee +14 -0
- data/spec/javascripts/{jasmine.headless-reporter_spec.coffee → jasmine.HeadlessConsoleReporter_spec.coffee} +2 -2
- data/spec/javascripts/support/jasmine.yml +1 -1
- data/spec/lib/jasmine/files_list_spec.rb +6 -3
- data/spec/lib/jasmine/headless/spec_file_analyzer_spec.rb +41 -30
- data/spec/lib/qt/qmake_spec.rb +0 -6
- data/vendor/assets/coffeescripts/headless_reporter_result.coffee +46 -0
- data/vendor/assets/coffeescripts/intense.coffee +27 -0
- data/{jasmine/jasmine.headless-reporter.coffee → vendor/assets/coffeescripts/jasmine-extensions.coffee} +5 -90
- data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +86 -0
- data/vendor/assets/coffeescripts/prolog.coffee +73 -0
- data/{js-lib → vendor/assets/javascripts}/beautify-html.js +0 -0
- data/vendor/assets/javascripts/headless_reporter_result.js +72 -0
- data/vendor/assets/javascripts/intense.js +37 -0
- data/vendor/assets/javascripts/jasmine-extensions.js +101 -0
- data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +96 -0
- data/{js-lib → vendor/assets/javascripts}/jsDump.js +0 -0
- data/vendor/assets/javascripts/prolog.js +89 -0
- metadata +28 -33
- data/dev-bin/hooks/pre-commit +0 -5
- data/dev-bin/install-hooks +0 -6
- data/ext/jasmine-webkit-specrunner/ConsoleOutput.cpp +0 -149
- data/ext/jasmine-webkit-specrunner/ConsoleOutput.h +0 -39
- data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.cpp +0 -129
- data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.h +0 -32
- data/ext/jasmine-webkit-specrunner/ConsoleOutput_test.pro +0 -7
- data/ext/jasmine-webkit-specrunner/Page_test.cpp +0 -43
- data/ext/jasmine-webkit-specrunner/Page_test.h +0 -27
- data/ext/jasmine-webkit-specrunner/Page_test.pro +0 -6
- data/ext/jasmine-webkit-specrunner/ReportFileOutput.cpp +0 -54
- data/ext/jasmine-webkit-specrunner/ReportFileOutput.h +0 -37
- data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.cpp +0 -88
- data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.h +0 -26
- data/ext/jasmine-webkit-specrunner/ReportFileOutput_test.pro +0 -7
- data/ext/jasmine-webkit-specrunner/test.pri +0 -3
- data/ext/jasmine-webkit-specrunner/test.rb +0 -31
- data/jasmine/jasmine.headless-reporter.js +0 -231
@@ -1,26 +0,0 @@
|
|
1
|
-
#ifndef JHW_TEST_REPORT_FILE_OUTPUT
|
2
|
-
#define JHW_TEST_REPORT_FILE_OUTPUT
|
3
|
-
|
4
|
-
#include <QtTest/QtTest>
|
5
|
-
#include <iostream>
|
6
|
-
#include <sstream>
|
7
|
-
#include <string>
|
8
|
-
|
9
|
-
#include "ReportFileOutput.h"
|
10
|
-
|
11
|
-
class ReportFileOutputTest : public QObject {
|
12
|
-
Q_OBJECT
|
13
|
-
public:
|
14
|
-
ReportFileOutputTest();
|
15
|
-
private slots:
|
16
|
-
void testPassed();
|
17
|
-
void testFailed();
|
18
|
-
void testErrorLog();
|
19
|
-
void testConsoleLog();
|
20
|
-
void testStubMethods();
|
21
|
-
void testReportFailure();
|
22
|
-
void testReportSuccess();
|
23
|
-
void testReportSuccessWithJSErrors();
|
24
|
-
};
|
25
|
-
|
26
|
-
#endif
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
system %{make clean}
|
6
|
-
|
7
|
-
$: << File.expand_path("../../../lib", __FILE__)
|
8
|
-
require 'qt/qmake'
|
9
|
-
|
10
|
-
result = 0
|
11
|
-
|
12
|
-
Dir['*_test.pro'].each do |test|
|
13
|
-
FileUtils.rm_f('jhw-test')
|
14
|
-
|
15
|
-
Qt::Qmake.make!('jasmine-headless-webkit', test)
|
16
|
-
|
17
|
-
if File.file?('jhw-test')
|
18
|
-
system %{./jhw-test}
|
19
|
-
if $?.exitstatus != 0
|
20
|
-
result = 1
|
21
|
-
break
|
22
|
-
end
|
23
|
-
else
|
24
|
-
result = 1
|
25
|
-
break
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
Qt::Qmake.make!('jasmine-headless-webkit', 'specrunner.pro')
|
30
|
-
|
31
|
-
exit result
|
@@ -1,231 +0,0 @@
|
|
1
|
-
(function() {
|
2
|
-
var getSplitName, pauseAndRun;
|
3
|
-
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
|
4
|
-
throw new Error("jasmine not laoded!");
|
5
|
-
}
|
6
|
-
if (window.JHW) {
|
7
|
-
getSplitName = function(parts) {
|
8
|
-
parts.push(String(this.description).replace(/[\n\r]/g, ' '));
|
9
|
-
return parts;
|
10
|
-
};
|
11
|
-
jasmine.Suite.prototype.getSuiteSplitName = function() {
|
12
|
-
return this.getSplitName(this.parentSuite ? this.parentSuite.getSuiteSplitName() : []);
|
13
|
-
};
|
14
|
-
jasmine.Spec.prototype.getSpecSplitName = function() {
|
15
|
-
return this.getSplitName(this.suite.getSuiteSplitName());
|
16
|
-
};
|
17
|
-
jasmine.Suite.prototype.getSplitName = getSplitName;
|
18
|
-
jasmine.Spec.prototype.getSplitName = getSplitName;
|
19
|
-
jasmine.Spec.prototype.getJHWSpecInformation = function() {
|
20
|
-
var parts, specLineInfo;
|
21
|
-
parts = this.getSpecSplitName();
|
22
|
-
specLineInfo = HeadlessReporterResult.findSpecLine(parts);
|
23
|
-
if (specLineInfo.file) {
|
24
|
-
parts.push("" + specLineInfo.file + ":" + specLineInfo.lineNumber);
|
25
|
-
} else {
|
26
|
-
parts.push('');
|
27
|
-
}
|
28
|
-
return parts.join("||");
|
29
|
-
};
|
30
|
-
jasmine.Spec.prototype.fail = function(e) {
|
31
|
-
var expectationResult, filename, realFilename;
|
32
|
-
if (e && e.sourceURL && window.CoffeeScriptToFilename) {
|
33
|
-
filename = e.sourceURL.split('/').pop();
|
34
|
-
if (realFilename = window.CoffeeScriptToFilename[filename]) {
|
35
|
-
e = {
|
36
|
-
name: e.name,
|
37
|
-
message: e.message,
|
38
|
-
lineNumber: "~" + String(e.line),
|
39
|
-
sourceURL: realFilename
|
40
|
-
};
|
41
|
-
}
|
42
|
-
}
|
43
|
-
expectationResult = new jasmine.ExpectationResult({
|
44
|
-
passed: false,
|
45
|
-
message: e ? jasmine.util.formatException(e) : 'Exception',
|
46
|
-
trace: {
|
47
|
-
stack: e.stack
|
48
|
-
}
|
49
|
-
});
|
50
|
-
return this.results_.addResult(expectationResult);
|
51
|
-
};
|
52
|
-
jasmine.NestedResults.isValidSpecLine = function(line) {
|
53
|
-
return line.match(/^\s*expect/) !== null || line.match(/^\s*return\s*expect/) !== null;
|
54
|
-
};
|
55
|
-
jasmine.NestedResults.parseFunction = function(func) {
|
56
|
-
var line, lineCount, lines, _i, _len, _ref;
|
57
|
-
lines = [];
|
58
|
-
lineCount = 0;
|
59
|
-
_ref = func.split("\n");
|
60
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
61
|
-
line = _ref[_i];
|
62
|
-
if (jasmine.NestedResults.isValidSpecLine(line)) {
|
63
|
-
line = line.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^return\s*/, '');
|
64
|
-
lines.push([line, lineCount]);
|
65
|
-
}
|
66
|
-
lineCount += 1;
|
67
|
-
}
|
68
|
-
return lines;
|
69
|
-
};
|
70
|
-
jasmine.NestedResults.parseAndStore = function(func) {
|
71
|
-
if (!jasmine.NestedResults.ParsedFunctions[func]) {
|
72
|
-
jasmine.NestedResults.ParsedFunctions[func] = jasmine.NestedResults.parseFunction(func);
|
73
|
-
}
|
74
|
-
return jasmine.NestedResults.ParsedFunctions[func];
|
75
|
-
};
|
76
|
-
jasmine.NestedResults.ParsedFunctions = [];
|
77
|
-
if (!jasmine.WaitsBlock.prototype._execute) {
|
78
|
-
jasmine.WaitsBlock.prototype._execute = jasmine.WaitsBlock.prototype.execute;
|
79
|
-
jasmine.WaitsForBlock.prototype._execute = jasmine.WaitsForBlock.prototype.execute;
|
80
|
-
pauseAndRun = function(onComplete) {
|
81
|
-
JHW.timerPause();
|
82
|
-
return this._execute(function() {
|
83
|
-
JHW.timerDone();
|
84
|
-
return onComplete();
|
85
|
-
});
|
86
|
-
};
|
87
|
-
jasmine.WaitsBlock.prototype.execute = pauseAndRun;
|
88
|
-
jasmine.WaitsForBlock.prototype.execute = pauseAndRun;
|
89
|
-
jasmine.NestedResults.prototype.addResult_ = jasmine.NestedResults.prototype.addResult;
|
90
|
-
jasmine.NestedResults.prototype.addResult = function(result) {
|
91
|
-
result.expectations = [];
|
92
|
-
result.expectations = jasmine.NestedResults.parseAndStore(arguments.callee.caller.caller.caller.toString());
|
93
|
-
return this.addResult_(result);
|
94
|
-
};
|
95
|
-
}
|
96
|
-
window.HeadlessReporterResult = (function() {
|
97
|
-
function HeadlessReporterResult(name, splitName) {
|
98
|
-
this.name = name;
|
99
|
-
this.splitName = splitName;
|
100
|
-
this.results = [];
|
101
|
-
}
|
102
|
-
HeadlessReporterResult.prototype.addResult = function(message) {
|
103
|
-
return this.results.push(message);
|
104
|
-
};
|
105
|
-
HeadlessReporterResult.prototype.print = function() {
|
106
|
-
var bestChoice, output, result, _i, _len, _ref, _results;
|
107
|
-
output = this.name;
|
108
|
-
bestChoice = HeadlessReporterResult.findSpecLine(this.splitName);
|
109
|
-
if (bestChoice.file) {
|
110
|
-
output += " (" + bestChoice.file + ":" + bestChoice.lineNumber + ")";
|
111
|
-
}
|
112
|
-
JHW.printName(output);
|
113
|
-
_ref = this.results;
|
114
|
-
_results = [];
|
115
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
116
|
-
result = _ref[_i];
|
117
|
-
output = result.message;
|
118
|
-
if (result.lineNumber) {
|
119
|
-
output += " (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")\n " + result.line;
|
120
|
-
}
|
121
|
-
_results.push(JHW.printResult(output));
|
122
|
-
}
|
123
|
-
return _results;
|
124
|
-
};
|
125
|
-
HeadlessReporterResult.findSpecLine = function(splitName) {
|
126
|
-
var bestChoice, file, index, lastLine, line, lineNumber, lines, newLineNumberInfo, _i, _len, _ref;
|
127
|
-
bestChoice = {
|
128
|
-
accuracy: 0,
|
129
|
-
file: null,
|
130
|
-
lineNumber: null
|
131
|
-
};
|
132
|
-
_ref = HeadlessReporterResult.specLineNumbers;
|
133
|
-
for (file in _ref) {
|
134
|
-
lines = _ref[file];
|
135
|
-
index = 0;
|
136
|
-
lineNumber = 0;
|
137
|
-
while (newLineNumberInfo = lines[splitName[index]]) {
|
138
|
-
if (newLineNumberInfo.length === 0) {
|
139
|
-
lineNumber = newLineNumberInfo[0];
|
140
|
-
} else {
|
141
|
-
lastLine = null;
|
142
|
-
for (_i = 0, _len = newLineNumberInfo.length; _i < _len; _i++) {
|
143
|
-
line = newLineNumberInfo[_i];
|
144
|
-
lastLine = line;
|
145
|
-
if (line > lineNumber) {
|
146
|
-
break;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
lineNumber = lastLine;
|
150
|
-
}
|
151
|
-
index++;
|
152
|
-
}
|
153
|
-
if (index > bestChoice.accuracy) {
|
154
|
-
bestChoice = {
|
155
|
-
accuracy: index,
|
156
|
-
file: file,
|
157
|
-
lineNumber: lineNumber
|
158
|
-
};
|
159
|
-
}
|
160
|
-
}
|
161
|
-
return bestChoice;
|
162
|
-
};
|
163
|
-
return HeadlessReporterResult;
|
164
|
-
})();
|
165
|
-
jasmine.HeadlessReporter = (function() {
|
166
|
-
function HeadlessReporter(callback) {
|
167
|
-
this.callback = callback != null ? callback : null;
|
168
|
-
this.results = [];
|
169
|
-
this.failedCount = 0;
|
170
|
-
this.length = 0;
|
171
|
-
}
|
172
|
-
HeadlessReporter.prototype.reportRunnerResults = function(runner) {
|
173
|
-
var result, _i, _len, _ref;
|
174
|
-
if (this.hasError()) {
|
175
|
-
return;
|
176
|
-
}
|
177
|
-
_ref = this.results;
|
178
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
179
|
-
result = _ref[_i];
|
180
|
-
result.print();
|
181
|
-
}
|
182
|
-
if (this.callback) {
|
183
|
-
this.callback();
|
184
|
-
}
|
185
|
-
return JHW.finishSuite((new Date() - this.startTime) / 1000.0, this.length, this.failedCount);
|
186
|
-
};
|
187
|
-
HeadlessReporter.prototype.reportRunnerStarting = function(runner) {
|
188
|
-
return this.startTime = new Date();
|
189
|
-
};
|
190
|
-
HeadlessReporter.prototype.reportSpecResults = function(spec) {
|
191
|
-
var failureResult, foundLine, result, results, testCount, _i, _len, _ref;
|
192
|
-
if (this.hasError()) {
|
193
|
-
return;
|
194
|
-
}
|
195
|
-
results = spec.results();
|
196
|
-
this.length++;
|
197
|
-
if (results.passed()) {
|
198
|
-
return JHW.specPassed(spec.getJHWSpecInformation());
|
199
|
-
} else {
|
200
|
-
JHW.specFailed(spec.getJHWSpecInformation());
|
201
|
-
this.failedCount++;
|
202
|
-
failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName());
|
203
|
-
testCount = 1;
|
204
|
-
_ref = results.getItems();
|
205
|
-
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
206
|
-
result = _ref[_i];
|
207
|
-
if (result.type === 'expect' && !result.passed_) {
|
208
|
-
if (foundLine = result.expectations[testCount - 1]) {
|
209
|
-
result.line = foundLine[0], result.lineNumber = foundLine[1];
|
210
|
-
}
|
211
|
-
failureResult.addResult(result);
|
212
|
-
}
|
213
|
-
testCount += 1;
|
214
|
-
}
|
215
|
-
return this.results.push(failureResult);
|
216
|
-
}
|
217
|
-
};
|
218
|
-
HeadlessReporter.prototype.reportSpecStarting = function(spec) {
|
219
|
-
if (this.hasError()) {
|
220
|
-
spec.finish();
|
221
|
-
return spec.suite.finish();
|
222
|
-
}
|
223
|
-
};
|
224
|
-
HeadlessReporter.prototype.reportSuiteResults = function(suite) {};
|
225
|
-
HeadlessReporter.prototype.hasError = function() {
|
226
|
-
return JHW.hasError();
|
227
|
-
};
|
228
|
-
return HeadlessReporter;
|
229
|
-
})();
|
230
|
-
}
|
231
|
-
}).call(this);
|