teaspoon 0.9.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +141 -0
- data/README.md +9 -19
- data/{vendor → app}/assets/javascripts/support/bind-poly.js +0 -0
- data/{vendor → app}/assets/javascripts/support/sinon.js +0 -0
- data/app/assets/javascripts/teaspoon-filterer.js +55 -0
- data/app/assets/javascripts/teaspoon/error.coffee +5 -0
- data/app/assets/javascripts/teaspoon/{base/fixture.coffee → fixture.coffee} +15 -15
- data/app/assets/javascripts/teaspoon/{base/hook.coffee → hook.coffee} +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/console.coffee +18 -10
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html.coffee +43 -40
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/base_view.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/failure_view.coffee +2 -0
- data/app/assets/javascripts/teaspoon/reporters/html/progress_view.coffee +18 -0
- data/app/assets/javascripts/teaspoon/{base/reporters/html/progress_view.coffee → reporters/html/radial_progress_view.coffee} +1 -34
- data/app/assets/javascripts/teaspoon/reporters/html/simple_progress_view.coffee +15 -0
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/spec_view.coffee +5 -3
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/suite_view.coffee +4 -2
- data/app/assets/javascripts/teaspoon/{base/reporters → reporters}/html/template.coffee +0 -0
- data/app/assets/javascripts/teaspoon/{base/runner.coffee → runner.coffee} +7 -3
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +90 -32
- data/app/controllers/teaspoon/suite_controller.rb +5 -0
- data/app/views/teaspoon/suite/index.html.erb +1 -1
- data/lib/generators/teaspoon/install/install_generator.rb +67 -37
- data/lib/generators/teaspoon/install/templates/MISSING_FRAMEWORK +14 -0
- data/lib/generators/teaspoon/install/{POST_INSTALL → templates/POST_INSTALL} +0 -0
- data/lib/generators/teaspoon/install/templates/env.rb.tt +14 -0
- data/lib/generators/teaspoon/install/templates/{jasmine/env_comments.rb.tt → env_comments.rb.tt} +34 -43
- data/lib/tasks/teaspoon/info.rake +17 -0
- data/lib/teaspoon-devkit.rb +61 -0
- data/lib/teaspoon.rb +2 -0
- data/lib/teaspoon/command_line.rb +19 -14
- data/lib/teaspoon/configuration.rb +24 -35
- data/lib/teaspoon/console.rb +11 -21
- data/lib/teaspoon/coverage.rb +14 -7
- data/lib/teaspoon/deprecated.rb +22 -4
- data/lib/teaspoon/driver.rb +15 -0
- data/lib/teaspoon/driver/base.rb +7 -0
- data/lib/teaspoon/{drivers/capybara_webkit_driver.rb → driver/capybara_webkit.rb} +8 -5
- data/lib/teaspoon/{drivers/phantomjs_driver.rb → driver/phantomjs.rb} +8 -4
- data/lib/teaspoon/{drivers → driver}/phantomjs/runner.js +0 -0
- data/lib/teaspoon/{drivers/selenium_driver.rb → driver/selenium.rb} +11 -9
- data/lib/teaspoon/engine.rb +38 -25
- data/lib/teaspoon/environment.rb +24 -15
- data/lib/teaspoon/exceptions.rb +154 -41
- data/lib/teaspoon/exporter.rb +2 -2
- data/lib/teaspoon/formatter.rb +30 -0
- data/lib/teaspoon/{formatters → formatter}/base.rb +2 -36
- data/lib/teaspoon/{formatters/clean_formatter.rb → formatter/clean.rb} +4 -2
- data/lib/teaspoon/{formatters/documentation_formatter.rb → formatter/documentation.rb} +4 -3
- data/lib/teaspoon/{formatters/dot_formatter.rb → formatter/dot.rb} +4 -3
- data/lib/teaspoon/{formatters/json_formatter.rb → formatter/json.rb} +4 -2
- data/lib/teaspoon/{formatters/junit_formatter.rb → formatter/junit.rb} +3 -2
- data/lib/teaspoon/{formatters → formatter}/modules/report_module.rb +1 -1
- data/lib/teaspoon/{formatters/pride_formatter.rb → formatter/pride.rb} +4 -2
- data/lib/teaspoon/{formatters/rspec_html_formatter.rb → formatter/rspec_html.rb} +3 -2
- data/lib/teaspoon/{formatters/snowday_formatter.rb → formatter/snowday.rb} +3 -2
- data/lib/teaspoon/formatter/swayze_or_oprah.rb +111 -0
- data/lib/teaspoon/{formatters/tap_formatter.rb → formatter/tap.rb} +4 -2
- data/lib/teaspoon/{formatters/tap_y_formatter.rb → formatter/tap_y.rb} +3 -2
- data/lib/teaspoon/{formatters/teamcity_formatter.rb → formatter/teamcity.rb} +4 -2
- data/lib/teaspoon/framework.rb +17 -0
- data/lib/teaspoon/framework/base.rb +88 -0
- data/lib/teaspoon/instrumentation.rb +12 -2
- data/lib/teaspoon/registry.rb +47 -0
- data/lib/teaspoon/registry/has_default.rb +11 -0
- data/lib/teaspoon/runner.rb +6 -7
- data/lib/teaspoon/server.rb +2 -2
- data/lib/teaspoon/suite.rb +28 -30
- data/lib/teaspoon/utility.rb +5 -0
- data/lib/teaspoon/version.rb +1 -1
- metadata +52 -276
- data/app/assets/javascripts/teaspoon-jasmine.js +0 -1344
- data/app/assets/javascripts/teaspoon-mocha.js +0 -1350
- data/app/assets/javascripts/teaspoon-qunit.js +0 -1415
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -51
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +0 -69
- data/app/assets/javascripts/teaspoon/jasmine.coffee +0 -119
- data/app/assets/javascripts/teaspoon/jasmine/reporters/html.coffee +0 -11
- data/app/assets/javascripts/teaspoon/mocha.coffee +0 -90
- data/app/assets/javascripts/teaspoon/mocha/reporters/console.coffee +0 -16
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +0 -27
- data/app/assets/javascripts/teaspoon/qunit.coffee +0 -81
- data/app/assets/javascripts/teaspoon/qunit/reporters/console.coffee +0 -25
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +0 -80
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +0 -31
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +0 -31
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +0 -40
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +0 -40
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +0 -11
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb.tt +0 -187
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +0 -29
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +0 -30
- data/lib/teaspoon/drivers/base.rb +0 -10
- data/lib/teaspoon/formatters/description.rb +0 -36
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +0 -101
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/instrumented1.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/instrumented2.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration.coffee +0 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +0 -32
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +0 -7
- data/spec/dummy/app/assets/javascripts/specs/asset_spec.js +0 -11
- data/spec/dummy/config.ru +0 -15
- data/spec/dummy/config/application.rb +0 -29
- data/spec/dummy/config/boot.rb +0 -3
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/routes.rb +0 -2
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/features/console_reporter_spec.rb +0 -62
- data/spec/features/hooks_spec.rb +0 -60
- data/spec/features/html_reporter_spec.rb +0 -81
- data/spec/features/install_generator_spec.rb +0 -54
- data/spec/features/instrumentation_spec.rb +0 -21
- data/spec/fixtures/coverage.json +0 -243
- data/spec/javascripts/fixtures/_body.html.erb +0 -1
- data/spec/javascripts/fixtures/fixture.html.haml +0 -4
- data/spec/javascripts/fixtures/fixture.json +0 -4
- data/spec/javascripts/jasmine_helper.coffee +0 -3
- data/spec/javascripts/mocha_helper.coffee +0 -4
- data/spec/javascripts/spec_helper.coffee +0 -7
- data/spec/javascripts/stylesheets/stylesheet.css.scss +0 -0
- data/spec/javascripts/support/json2.js +0 -486
- data/spec/javascripts/support/support.js.coffee +0 -0
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +0 -93
- data/spec/javascripts/teaspoon/base/reporters/console_spec.coffee +0 -162
- data/spec/javascripts/teaspoon/base/reporters/html/base_view_spec.coffee +0 -88
- data/spec/javascripts/teaspoon/base/reporters/html/failure_view_spec.coffee +0 -28
- data/spec/javascripts/teaspoon/base/reporters/html/progress_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/spec_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html/suite_view_spec.coffee +0 -1
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +0 -372
- data/spec/javascripts/teaspoon/base/runner_spec.coffee +0 -58
- data/spec/javascripts/teaspoon/base/teaspoon_spec.coffee +0 -47
- data/spec/javascripts/teaspoon/jasmine/fixture_jspec.coffee +0 -13
- data/spec/javascripts/teaspoon/jasmine/models_jspec.coffee +0 -101
- data/spec/javascripts/teaspoon/jasmine/reporters/html_jspec.coffee +0 -17
- data/spec/javascripts/teaspoon/jasmine/runner_jspec.coffee +0 -59
- data/spec/javascripts/teaspoon/jasmine/spec_jspec.coffee +0 -3
- data/spec/javascripts/teaspoon/mocha/fixture_mspec.coffee +0 -12
- data/spec/javascripts/teaspoon/mocha/models_mspec.coffee +0 -93
- data/spec/javascripts/teaspoon/mocha/reporters/console_mspec.coffee +0 -24
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -41
- data/spec/javascripts/teaspoon/mocha/runner_mspec.coffee +0 -23
- data/spec/javascripts/teaspoon/mocha/spec_mspec.coffee +0 -9
- data/spec/javascripts/teaspoon/other/erb_spec.js.coffee.erb +0 -4
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +0 -161
- data/spec/javascripts/turbolinks_helper.coffee +0 -2
- data/spec/spec_helper.rb +0 -25
- data/spec/support/aruba.rb +0 -15
- data/spec/teaspoon/command_line_spec.rb +0 -157
- data/spec/teaspoon/configuration_spec.rb +0 -236
- data/spec/teaspoon/console_spec.rb +0 -224
- data/spec/teaspoon/coverage_spec.rb +0 -118
- data/spec/teaspoon/drivers/base_spec.rb +0 -5
- data/spec/teaspoon/drivers/capybara_webkit_driver_spec.rb +0 -39
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +0 -66
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +0 -68
- data/spec/teaspoon/engine_spec.rb +0 -22
- data/spec/teaspoon/environment_spec.rb +0 -109
- data/spec/teaspoon/exceptions_spec.rb +0 -57
- data/spec/teaspoon/exporter_spec.rb +0 -96
- data/spec/teaspoon/formatters/base_spec.rb +0 -259
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +0 -127
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +0 -116
- data/spec/teaspoon/formatters/json_formatter_spec.rb +0 -77
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +0 -114
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +0 -37
- data/spec/teaspoon/formatters/rspec_html_formatter_spec.rb +0 -107
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +0 -35
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +0 -72
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +0 -80
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +0 -148
- data/spec/teaspoon/instrumentation_spec.rb +0 -113
- data/spec/teaspoon/result_spec.rb +0 -98
- data/spec/teaspoon/runner_spec.rb +0 -116
- data/spec/teaspoon/server_spec.rb +0 -105
- data/spec/teaspoon/suite_spec.rb +0 -138
- data/spec/teaspoon_env.rb +0 -39
- data/test/javascripts/qunit_helper.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/fixture_test.coffee +0 -10
- data/test/javascripts/teaspoon/qunit/models_test.coffee +0 -66
- data/test/javascripts/teaspoon/qunit/reporters/console_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/failure_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/spec_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html/suite_view_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/reporters/html_test.coffee +0 -3
- data/test/javascripts/teaspoon/qunit/runner_test.coffee +0 -18
- data/vendor/assets/javascripts/jasmine/1.3.1.js +0 -2602
- data/vendor/assets/javascripts/jasmine/2.0.0.js +0 -2412
- data/vendor/assets/javascripts/jasmine/MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/mocha/1.10.0.js +0 -5374
- data/vendor/assets/javascripts/mocha/1.17.1.js +0 -5813
- data/vendor/assets/javascripts/mocha/MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/qunit/1.12.0.js +0 -2212
- data/vendor/assets/javascripts/qunit/1.14.0.js +0 -2288
- data/vendor/assets/javascripts/qunit/MIT.LICENSE +0 -21
- data/vendor/assets/javascripts/support/chai-1.10.0.js +0 -4800
- data/vendor/assets/javascripts/support/chai-jq-0.0.7.js +0 -524
- data/vendor/assets/javascripts/support/chai.js +0 -4782
- data/vendor/assets/javascripts/support/expect.js +0 -1284
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +0 -720
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +0 -812
- data/vendor/assets/javascripts/support/sinon-chai.js +0 -126
@@ -1,1350 +0,0 @@
|
|
1
|
-
(function() {
|
2
|
-
var extend = 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; },
|
3
|
-
hasProp = {}.hasOwnProperty;
|
4
|
-
|
5
|
-
this.Teaspoon = (function() {
|
6
|
-
function Teaspoon() {}
|
7
|
-
|
8
|
-
Teaspoon.defer = false;
|
9
|
-
|
10
|
-
Teaspoon.slow = 75;
|
11
|
-
|
12
|
-
Teaspoon.root = window.location.pathname.replace(/\/+(index\.html)?$/, "").replace(/\/[^\/]*$/, "");
|
13
|
-
|
14
|
-
Teaspoon.started = false;
|
15
|
-
|
16
|
-
Teaspoon.finished = false;
|
17
|
-
|
18
|
-
Teaspoon.Reporters = {};
|
19
|
-
|
20
|
-
Teaspoon.Date = Date;
|
21
|
-
|
22
|
-
Teaspoon.location = window.location;
|
23
|
-
|
24
|
-
Teaspoon.messages = [];
|
25
|
-
|
26
|
-
Teaspoon.execute = function() {
|
27
|
-
if (Teaspoon.defer) {
|
28
|
-
Teaspoon.defer = false;
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
if (Teaspoon.started) {
|
32
|
-
Teaspoon.reload();
|
33
|
-
}
|
34
|
-
Teaspoon.started = true;
|
35
|
-
return new Teaspoon.Runner();
|
36
|
-
};
|
37
|
-
|
38
|
-
Teaspoon.reload = function() {
|
39
|
-
return window.location.reload();
|
40
|
-
};
|
41
|
-
|
42
|
-
Teaspoon.onWindowLoad = function(method) {
|
43
|
-
var originalOnload;
|
44
|
-
originalOnload = window.onload;
|
45
|
-
return window.onload = function() {
|
46
|
-
if (originalOnload && originalOnload.call) {
|
47
|
-
originalOnload();
|
48
|
-
}
|
49
|
-
return method();
|
50
|
-
};
|
51
|
-
};
|
52
|
-
|
53
|
-
Teaspoon.resolveDependenciesFromParams = function(all) {
|
54
|
-
var dep, deps, file, i, j, len, len1, parts, path, paths;
|
55
|
-
if (all == null) {
|
56
|
-
all = [];
|
57
|
-
}
|
58
|
-
deps = [];
|
59
|
-
if ((paths = Teaspoon.location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) === null) {
|
60
|
-
return all;
|
61
|
-
}
|
62
|
-
for (i = 0, len = paths.length; i < len; i++) {
|
63
|
-
path = paths[i];
|
64
|
-
parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i);
|
65
|
-
if (parts === null) {
|
66
|
-
continue;
|
67
|
-
}
|
68
|
-
file = parts[1].substr(parts[1].lastIndexOf("/") + 1);
|
69
|
-
for (j = 0, len1 = all.length; j < len1; j++) {
|
70
|
-
dep = all[j];
|
71
|
-
if (dep.indexOf(file) >= 0) {
|
72
|
-
deps.push(dep);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
}
|
76
|
-
return deps;
|
77
|
-
};
|
78
|
-
|
79
|
-
Teaspoon.log = function() {
|
80
|
-
var e;
|
81
|
-
Teaspoon.messages.push(arguments[0]);
|
82
|
-
try {
|
83
|
-
return console.log.apply(console, arguments);
|
84
|
-
} catch (_error) {
|
85
|
-
e = _error;
|
86
|
-
throw new Error("Unable to use console.log for logging");
|
87
|
-
}
|
88
|
-
};
|
89
|
-
|
90
|
-
Teaspoon.getMessages = function() {
|
91
|
-
var messages;
|
92
|
-
messages = Teaspoon.messages;
|
93
|
-
Teaspoon.messages = [];
|
94
|
-
return messages;
|
95
|
-
};
|
96
|
-
|
97
|
-
return Teaspoon;
|
98
|
-
|
99
|
-
})();
|
100
|
-
|
101
|
-
Teaspoon.Error = (function(superClass) {
|
102
|
-
extend(Error, superClass);
|
103
|
-
|
104
|
-
function Error(message) {
|
105
|
-
this.name = "TeaspoonError";
|
106
|
-
this.message = message || "";
|
107
|
-
}
|
108
|
-
|
109
|
-
return Error;
|
110
|
-
|
111
|
-
})(Error);
|
112
|
-
|
113
|
-
}).call(this);
|
114
|
-
(function() {
|
115
|
-
Teaspoon.Runner = (function() {
|
116
|
-
Runner.run = false;
|
117
|
-
|
118
|
-
function Runner() {
|
119
|
-
if (this.constructor.run) {
|
120
|
-
return;
|
121
|
-
}
|
122
|
-
this.constructor.run = true;
|
123
|
-
this.fixturePath = Teaspoon.root + "/fixtures";
|
124
|
-
this.params = Teaspoon.params = this.getParams();
|
125
|
-
this.setup();
|
126
|
-
}
|
127
|
-
|
128
|
-
Runner.prototype.getParams = function() {
|
129
|
-
var i, len, name, param, params, ref, ref1, value;
|
130
|
-
params = {};
|
131
|
-
ref = Teaspoon.location.search.substring(1).split("&");
|
132
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
133
|
-
param = ref[i];
|
134
|
-
ref1 = param.split("="), name = ref1[0], value = ref1[1];
|
135
|
-
params[decodeURIComponent(name)] = decodeURIComponent(value);
|
136
|
-
}
|
137
|
-
return params;
|
138
|
-
};
|
139
|
-
|
140
|
-
Runner.prototype.getReporter = function() {
|
141
|
-
if (this.params["reporter"]) {
|
142
|
-
return Teaspoon.Reporters[this.params["reporter"]];
|
143
|
-
} else {
|
144
|
-
if (window.navigator.userAgent.match(/PhantomJS/)) {
|
145
|
-
return Teaspoon.Reporters.Console;
|
146
|
-
} else {
|
147
|
-
return Teaspoon.Reporters.HTML;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
};
|
151
|
-
|
152
|
-
Runner.prototype.setup = function() {};
|
153
|
-
|
154
|
-
return Runner;
|
155
|
-
|
156
|
-
})();
|
157
|
-
|
158
|
-
}).call(this);
|
159
|
-
(function() {
|
160
|
-
var slice = [].slice;
|
161
|
-
|
162
|
-
Teaspoon.fixture = (function() {
|
163
|
-
var addContent, cleanup, create, load, loadComplete, preload, putContent, set, xhr, xhrRequest;
|
164
|
-
|
165
|
-
fixture.cache = {};
|
166
|
-
|
167
|
-
fixture.el = null;
|
168
|
-
|
169
|
-
fixture.$el = null;
|
170
|
-
|
171
|
-
fixture.json = [];
|
172
|
-
|
173
|
-
fixture.preload = function() {
|
174
|
-
var i, len, results, url, urls;
|
175
|
-
urls = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
176
|
-
results = [];
|
177
|
-
for (i = 0, len = urls.length; i < len; i++) {
|
178
|
-
url = urls[i];
|
179
|
-
results.push(preload(url));
|
180
|
-
}
|
181
|
-
return results;
|
182
|
-
};
|
183
|
-
|
184
|
-
fixture.load = function() {
|
185
|
-
var append, i, index, j, len, results, url, urls;
|
186
|
-
urls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
187
|
-
if (append == null) {
|
188
|
-
append = false;
|
189
|
-
}
|
190
|
-
if (typeof append !== "boolean") {
|
191
|
-
urls.push(append);
|
192
|
-
append = false;
|
193
|
-
}
|
194
|
-
results = [];
|
195
|
-
for (index = j = 0, len = urls.length; j < len; index = ++j) {
|
196
|
-
url = urls[index];
|
197
|
-
results.push(load(url, append || index > 0));
|
198
|
-
}
|
199
|
-
return results;
|
200
|
-
};
|
201
|
-
|
202
|
-
fixture.set = function() {
|
203
|
-
var append, html, htmls, i, index, j, len, results;
|
204
|
-
htmls = 2 <= arguments.length ? slice.call(arguments, 0, i = arguments.length - 1) : (i = 0, []), append = arguments[i++];
|
205
|
-
if (append == null) {
|
206
|
-
append = false;
|
207
|
-
}
|
208
|
-
if (typeof append !== "boolean") {
|
209
|
-
htmls.push(append);
|
210
|
-
append = false;
|
211
|
-
}
|
212
|
-
results = [];
|
213
|
-
for (index = j = 0, len = htmls.length; j < len; index = ++j) {
|
214
|
-
html = htmls[index];
|
215
|
-
results.push(set(html, append || index > 0));
|
216
|
-
}
|
217
|
-
return results;
|
218
|
-
};
|
219
|
-
|
220
|
-
fixture.cleanup = function() {
|
221
|
-
return cleanup();
|
222
|
-
};
|
223
|
-
|
224
|
-
function fixture() {
|
225
|
-
Teaspoon.fixture.load.apply(window, arguments);
|
226
|
-
}
|
227
|
-
|
228
|
-
xhr = null;
|
229
|
-
|
230
|
-
preload = function(url) {
|
231
|
-
return load(url, false, true);
|
232
|
-
};
|
233
|
-
|
234
|
-
load = function(url, append, preload) {
|
235
|
-
var cached, value;
|
236
|
-
if (preload == null) {
|
237
|
-
preload = false;
|
238
|
-
}
|
239
|
-
if (cached = Teaspoon.fixture.cache[url]) {
|
240
|
-
return loadComplete(url, cached.type, cached.content, append, preload);
|
241
|
-
}
|
242
|
-
value = null;
|
243
|
-
xhrRequest(url, function() {
|
244
|
-
if (xhr.readyState !== 4) {
|
245
|
-
return;
|
246
|
-
}
|
247
|
-
if (xhr.status !== 200) {
|
248
|
-
throw "Unable to load fixture \"" + url + "\".";
|
249
|
-
}
|
250
|
-
return value = loadComplete(url, xhr.getResponseHeader("content-type"), xhr.responseText, append, preload);
|
251
|
-
});
|
252
|
-
return value;
|
253
|
-
};
|
254
|
-
|
255
|
-
loadComplete = function(url, type, content, append, preload) {
|
256
|
-
Teaspoon.fixture.cache[url] = {
|
257
|
-
type: type,
|
258
|
-
content: content
|
259
|
-
};
|
260
|
-
if (type.match(/application\/json;/)) {
|
261
|
-
return fixture.json[fixture.json.push(JSON.parse(content)) - 1];
|
262
|
-
}
|
263
|
-
if (preload) {
|
264
|
-
return content;
|
265
|
-
}
|
266
|
-
if (append) {
|
267
|
-
addContent(content);
|
268
|
-
} else {
|
269
|
-
putContent(content);
|
270
|
-
}
|
271
|
-
return Teaspoon.fixture.el;
|
272
|
-
};
|
273
|
-
|
274
|
-
set = function(content, append) {
|
275
|
-
if (append) {
|
276
|
-
return addContent(content);
|
277
|
-
} else {
|
278
|
-
return putContent(content);
|
279
|
-
}
|
280
|
-
};
|
281
|
-
|
282
|
-
putContent = function(content) {
|
283
|
-
cleanup();
|
284
|
-
create();
|
285
|
-
return Teaspoon.fixture.el.innerHTML = content;
|
286
|
-
};
|
287
|
-
|
288
|
-
addContent = function(content) {
|
289
|
-
if (!Teaspoon.fixture.el) {
|
290
|
-
create();
|
291
|
-
}
|
292
|
-
return Teaspoon.fixture.el.innerHTML += content;
|
293
|
-
};
|
294
|
-
|
295
|
-
create = function() {
|
296
|
-
var ref;
|
297
|
-
Teaspoon.fixture.el = document.createElement("div");
|
298
|
-
if (typeof window.$ === 'function') {
|
299
|
-
Teaspoon.fixture.$el = $(Teaspoon.fixture.el);
|
300
|
-
}
|
301
|
-
Teaspoon.fixture.el.id = "teaspoon-fixtures";
|
302
|
-
return (ref = document.body) != null ? ref.appendChild(Teaspoon.fixture.el) : void 0;
|
303
|
-
};
|
304
|
-
|
305
|
-
cleanup = function() {
|
306
|
-
var base, ref, ref1;
|
307
|
-
(base = Teaspoon.fixture).el || (base.el = document.getElementById("teaspoon-fixtures"));
|
308
|
-
if ((ref = Teaspoon.fixture.el) != null) {
|
309
|
-
if ((ref1 = ref.parentNode) != null) {
|
310
|
-
ref1.removeChild(Teaspoon.fixture.el);
|
311
|
-
}
|
312
|
-
}
|
313
|
-
return Teaspoon.fixture.el = null;
|
314
|
-
};
|
315
|
-
|
316
|
-
xhrRequest = function(url, callback) {
|
317
|
-
var e;
|
318
|
-
if (window.XMLHttpRequest) {
|
319
|
-
xhr = new XMLHttpRequest();
|
320
|
-
} else if (window.ActiveXObject) {
|
321
|
-
try {
|
322
|
-
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
323
|
-
} catch (_error) {
|
324
|
-
e = _error;
|
325
|
-
try {
|
326
|
-
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
327
|
-
} catch (_error) {
|
328
|
-
e = _error;
|
329
|
-
}
|
330
|
-
}
|
331
|
-
}
|
332
|
-
if (!xhr) {
|
333
|
-
throw "Unable to make Ajax Request";
|
334
|
-
}
|
335
|
-
xhr.onreadystatechange = callback;
|
336
|
-
xhr.open("GET", Teaspoon.root + "/fixtures/" + url, false);
|
337
|
-
return xhr.send();
|
338
|
-
};
|
339
|
-
|
340
|
-
return fixture;
|
341
|
-
|
342
|
-
})();
|
343
|
-
|
344
|
-
}).call(this);
|
345
|
-
(function() {
|
346
|
-
Teaspoon.hook = function(name, payload) {
|
347
|
-
var xhr, xhrRequest;
|
348
|
-
if (payload == null) {
|
349
|
-
payload = {};
|
350
|
-
}
|
351
|
-
xhr = null;
|
352
|
-
xhrRequest = function(url, payload, callback) {
|
353
|
-
var e;
|
354
|
-
if (window.XMLHttpRequest) {
|
355
|
-
xhr = new XMLHttpRequest();
|
356
|
-
} else if (window.ActiveXObject) {
|
357
|
-
try {
|
358
|
-
xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
359
|
-
} catch (_error) {
|
360
|
-
e = _error;
|
361
|
-
try {
|
362
|
-
xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
363
|
-
} catch (_error) {
|
364
|
-
e = _error;
|
365
|
-
}
|
366
|
-
}
|
367
|
-
}
|
368
|
-
if (!xhr) {
|
369
|
-
throw "Unable to make Ajax Request";
|
370
|
-
}
|
371
|
-
xhr.onreadystatechange = callback;
|
372
|
-
xhr.open("POST", Teaspoon.root + "/" + url, false);
|
373
|
-
xhr.setRequestHeader("Content-Type", "application/json");
|
374
|
-
return xhr.send(JSON.stringify({
|
375
|
-
args: payload
|
376
|
-
}));
|
377
|
-
};
|
378
|
-
return xhrRequest(Teaspoon.suites.active + "/" + name, payload, function() {
|
379
|
-
if (xhr.readyState !== 4) {
|
380
|
-
return;
|
381
|
-
}
|
382
|
-
if (xhr.status !== 200) {
|
383
|
-
throw "Unable to call hook \"" + url + "\".";
|
384
|
-
}
|
385
|
-
});
|
386
|
-
};
|
387
|
-
|
388
|
-
}).call(this);
|
389
|
-
(function() {
|
390
|
-
Teaspoon.Reporters.BaseView = (function() {
|
391
|
-
function BaseView() {
|
392
|
-
this.elements = {};
|
393
|
-
this.build();
|
394
|
-
}
|
395
|
-
|
396
|
-
BaseView.prototype.build = function(className) {
|
397
|
-
return this.el = this.createEl("li", className);
|
398
|
-
};
|
399
|
-
|
400
|
-
BaseView.prototype.appendTo = function(el) {
|
401
|
-
return el.appendChild(this.el);
|
402
|
-
};
|
403
|
-
|
404
|
-
BaseView.prototype.append = function(el) {
|
405
|
-
return this.el.appendChild(el);
|
406
|
-
};
|
407
|
-
|
408
|
-
BaseView.prototype.createEl = function(type, className) {
|
409
|
-
var el;
|
410
|
-
if (className == null) {
|
411
|
-
className = "";
|
412
|
-
}
|
413
|
-
el = document.createElement(type);
|
414
|
-
el.className = className;
|
415
|
-
return el;
|
416
|
-
};
|
417
|
-
|
418
|
-
BaseView.prototype.findEl = function(id) {
|
419
|
-
var base;
|
420
|
-
this.elements || (this.elements = {});
|
421
|
-
return (base = this.elements)[id] || (base[id] = document.getElementById("teaspoon-" + id));
|
422
|
-
};
|
423
|
-
|
424
|
-
BaseView.prototype.setText = function(id, value) {
|
425
|
-
var el;
|
426
|
-
el = this.findEl(id);
|
427
|
-
return el.innerHTML = value;
|
428
|
-
};
|
429
|
-
|
430
|
-
BaseView.prototype.setHtml = function(id, value, add) {
|
431
|
-
var el;
|
432
|
-
if (add == null) {
|
433
|
-
add = false;
|
434
|
-
}
|
435
|
-
el = this.findEl(id);
|
436
|
-
if (add) {
|
437
|
-
return el.innerHTML += value;
|
438
|
-
} else {
|
439
|
-
return el.innerHTML = value;
|
440
|
-
}
|
441
|
-
};
|
442
|
-
|
443
|
-
BaseView.prototype.setClass = function(id, value) {
|
444
|
-
var el;
|
445
|
-
el = this.findEl(id);
|
446
|
-
return el.className = value;
|
447
|
-
};
|
448
|
-
|
449
|
-
BaseView.prototype.htmlSafe = function(str) {
|
450
|
-
var el;
|
451
|
-
el = document.createElement("div");
|
452
|
-
el.appendChild(document.createTextNode(str));
|
453
|
-
return el.innerHTML;
|
454
|
-
};
|
455
|
-
|
456
|
-
return BaseView;
|
457
|
-
|
458
|
-
})();
|
459
|
-
|
460
|
-
}).call(this);
|
461
|
-
(function() {
|
462
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
463
|
-
extend = 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; },
|
464
|
-
hasProp = {}.hasOwnProperty;
|
465
|
-
|
466
|
-
Teaspoon.Reporters.HTML = (function(superClass) {
|
467
|
-
extend(HTML, superClass);
|
468
|
-
|
469
|
-
function HTML() {
|
470
|
-
this.changeSuite = bind(this.changeSuite, this);
|
471
|
-
this.toggleConfig = bind(this.toggleConfig, this);
|
472
|
-
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
473
|
-
this.start = new Teaspoon.Date().getTime();
|
474
|
-
this.config = {
|
475
|
-
"use-catch": true,
|
476
|
-
"build-full-report": false,
|
477
|
-
"display-progress": true
|
478
|
-
};
|
479
|
-
this.total = {
|
480
|
-
exist: 0,
|
481
|
-
run: 0,
|
482
|
-
passes: 0,
|
483
|
-
failures: 0,
|
484
|
-
skipped: 0
|
485
|
-
};
|
486
|
-
this.views = {
|
487
|
-
specs: {},
|
488
|
-
suites: {}
|
489
|
-
};
|
490
|
-
this.filters = [];
|
491
|
-
this.setFilters();
|
492
|
-
this.readConfig();
|
493
|
-
HTML.__super__.constructor.apply(this, arguments);
|
494
|
-
}
|
495
|
-
|
496
|
-
HTML.prototype.build = function() {
|
497
|
-
var ref;
|
498
|
-
this.buildLayout();
|
499
|
-
this.setText("env-info", this.envInfo());
|
500
|
-
this.setText("version", Teaspoon.version);
|
501
|
-
this.findEl("toggles").onclick = this.toggleConfig;
|
502
|
-
this.findEl("suites").innerHTML = this.buildSuiteSelect();
|
503
|
-
if ((ref = this.findEl("suite-select")) != null) {
|
504
|
-
ref.onchange = this.changeSuite;
|
505
|
-
}
|
506
|
-
this.el = this.findEl("report-all");
|
507
|
-
this.showConfiguration();
|
508
|
-
this.buildProgress();
|
509
|
-
return this.buildFilters();
|
510
|
-
};
|
511
|
-
|
512
|
-
HTML.prototype.buildLayout = function() {
|
513
|
-
var el;
|
514
|
-
el = this.createEl("div");
|
515
|
-
el.id = "teaspoon-interface";
|
516
|
-
el.innerHTML = Teaspoon.Reporters.HTML.template();
|
517
|
-
return document.body.appendChild(el);
|
518
|
-
};
|
519
|
-
|
520
|
-
HTML.prototype.buildSuiteSelect = function() {
|
521
|
-
var filename, i, len, options, path, ref, selected, suite;
|
522
|
-
if (Teaspoon.suites.all.length === 1) {
|
523
|
-
return "";
|
524
|
-
}
|
525
|
-
filename = "";
|
526
|
-
if (/index\.html$/.test(window.location.pathname)) {
|
527
|
-
filename = "/index.html";
|
528
|
-
}
|
529
|
-
options = [];
|
530
|
-
ref = Teaspoon.suites.all;
|
531
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
532
|
-
suite = ref[i];
|
533
|
-
path = [Teaspoon.root, suite].join("/");
|
534
|
-
selected = Teaspoon.suites.active === suite ? " selected" : "";
|
535
|
-
options.push("<option" + selected + " value=\"" + path + filename + "\">" + suite + "</option>");
|
536
|
-
}
|
537
|
-
return "<select id=\"teaspoon-suite-select\">" + (options.join("")) + "</select>";
|
538
|
-
};
|
539
|
-
|
540
|
-
HTML.prototype.buildProgress = function() {
|
541
|
-
this.progress = Teaspoon.Reporters.HTML.ProgressView.create(this.config["display-progress"]);
|
542
|
-
return this.progress.appendTo(this.findEl("progress"));
|
543
|
-
};
|
544
|
-
|
545
|
-
HTML.prototype.buildFilters = function() {
|
546
|
-
if (this.filters.length) {
|
547
|
-
this.setClass("filter", "teaspoon-filtered");
|
548
|
-
}
|
549
|
-
return this.setHtml("filter-list", "<li>" + (this.filters.join("</li><li>")), true);
|
550
|
-
};
|
551
|
-
|
552
|
-
HTML.prototype.reportRunnerStarting = function(runner) {
|
553
|
-
this.total.exist = runner.total || (typeof runner.specs === "function" ? runner.specs().length : void 0) || 0;
|
554
|
-
if (this.total.exist) {
|
555
|
-
return this.setText("stats-duration", "...");
|
556
|
-
}
|
557
|
-
};
|
558
|
-
|
559
|
-
HTML.prototype.reportSpecStarting = function(spec) {
|
560
|
-
spec = new Teaspoon.Spec(spec);
|
561
|
-
if (this.config["build-full-report"]) {
|
562
|
-
this.reportView = new Teaspoon.Reporters.HTML.SpecView(spec, this);
|
563
|
-
}
|
564
|
-
return this.specStart = new Teaspoon.Date().getTime();
|
565
|
-
};
|
566
|
-
|
567
|
-
HTML.prototype.reportSpecResults = function(spec) {
|
568
|
-
this.total.run += 1;
|
569
|
-
this.updateProgress();
|
570
|
-
return this.updateStatus(spec);
|
571
|
-
};
|
572
|
-
|
573
|
-
HTML.prototype.reportRunnerResults = function() {
|
574
|
-
if (!this.total.run) {
|
575
|
-
return;
|
576
|
-
}
|
577
|
-
this.setText("stats-duration", this.elapsedTime());
|
578
|
-
if (!this.total.failures) {
|
579
|
-
this.setStatus("passed");
|
580
|
-
}
|
581
|
-
this.setText("stats-passes", this.total.passes);
|
582
|
-
this.setText("stats-failures", this.total.failures);
|
583
|
-
if (this.total.run < this.total.exist) {
|
584
|
-
this.total.skipped = this.total.exist - this.total.run;
|
585
|
-
this.total.run = this.total.exist;
|
586
|
-
}
|
587
|
-
this.setText("stats-skipped", this.total.skipped);
|
588
|
-
return this.updateProgress();
|
589
|
-
};
|
590
|
-
|
591
|
-
HTML.prototype.elapsedTime = function() {
|
592
|
-
return (((new Teaspoon.Date().getTime() - this.start) / 1000).toFixed(3)) + "s";
|
593
|
-
};
|
594
|
-
|
595
|
-
HTML.prototype.updateStat = function(name, value) {
|
596
|
-
if (!this.config["display-progress"]) {
|
597
|
-
return;
|
598
|
-
}
|
599
|
-
return this.setText("stats-" + name, value);
|
600
|
-
};
|
601
|
-
|
602
|
-
HTML.prototype.updateStatus = function(spec) {
|
603
|
-
var elapsed, ref, ref1, result;
|
604
|
-
spec = new Teaspoon.Spec(spec);
|
605
|
-
result = spec.result();
|
606
|
-
if (result.skipped || result.status === "pending") {
|
607
|
-
this.updateStat("skipped", this.total.skipped += 1);
|
608
|
-
return;
|
609
|
-
}
|
610
|
-
elapsed = new Teaspoon.Date().getTime() - this.specStart;
|
611
|
-
if (result.status === "passed") {
|
612
|
-
this.updateStat("passes", this.total.passes += 1);
|
613
|
-
return (ref = this.reportView) != null ? ref.updateState("passed", elapsed) : void 0;
|
614
|
-
} else {
|
615
|
-
this.updateStat("failures", this.total.failures += 1);
|
616
|
-
if ((ref1 = this.reportView) != null) {
|
617
|
-
ref1.updateState("failed", elapsed);
|
618
|
-
}
|
619
|
-
if (!this.config["build-full-report"]) {
|
620
|
-
new Teaspoon.Reporters.HTML.FailureView(spec).appendTo(this.findEl("report-failures"));
|
621
|
-
}
|
622
|
-
return this.setStatus("failed");
|
623
|
-
}
|
624
|
-
};
|
625
|
-
|
626
|
-
HTML.prototype.updateProgress = function() {
|
627
|
-
return this.progress.update(this.total.exist, this.total.run);
|
628
|
-
};
|
629
|
-
|
630
|
-
HTML.prototype.showConfiguration = function() {
|
631
|
-
var key, ref, results, value;
|
632
|
-
ref = this.config;
|
633
|
-
results = [];
|
634
|
-
for (key in ref) {
|
635
|
-
value = ref[key];
|
636
|
-
results.push(this.setClass(key, value ? "active" : ""));
|
637
|
-
}
|
638
|
-
return results;
|
639
|
-
};
|
640
|
-
|
641
|
-
HTML.prototype.setStatus = function(status) {
|
642
|
-
return document.body.className = "teaspoon-" + status;
|
643
|
-
};
|
644
|
-
|
645
|
-
HTML.prototype.setFilters = function() {
|
646
|
-
if (Teaspoon.params["file"]) {
|
647
|
-
this.filters.push("by file: " + Teaspoon.params["file"]);
|
648
|
-
}
|
649
|
-
if (Teaspoon.params["grep"]) {
|
650
|
-
return this.filters.push("by match: " + Teaspoon.params["grep"]);
|
651
|
-
}
|
652
|
-
};
|
653
|
-
|
654
|
-
HTML.prototype.readConfig = function() {
|
655
|
-
var config;
|
656
|
-
if (config = this.store("teaspoon")) {
|
657
|
-
return this.config = config;
|
658
|
-
}
|
659
|
-
};
|
660
|
-
|
661
|
-
HTML.prototype.toggleConfig = function(e) {
|
662
|
-
var button, name;
|
663
|
-
button = e.target;
|
664
|
-
if (button.tagName.toLowerCase() !== "button") {
|
665
|
-
return;
|
666
|
-
}
|
667
|
-
name = button.getAttribute("id").replace(/^teaspoon-/, "");
|
668
|
-
this.config[name] = !this.config[name];
|
669
|
-
this.store("teaspoon", this.config);
|
670
|
-
return Teaspoon.reload();
|
671
|
-
};
|
672
|
-
|
673
|
-
HTML.prototype.changeSuite = function(e) {
|
674
|
-
var options;
|
675
|
-
options = e.target.options;
|
676
|
-
return window.location.href = options[options.selectedIndex].value;
|
677
|
-
};
|
678
|
-
|
679
|
-
HTML.prototype.store = function(name, value) {
|
680
|
-
var ref;
|
681
|
-
if (((ref = window.localStorage) != null ? ref.setItem : void 0) != null) {
|
682
|
-
return this.localstore(name, value);
|
683
|
-
} else {
|
684
|
-
return this.cookie(name, value);
|
685
|
-
}
|
686
|
-
};
|
687
|
-
|
688
|
-
HTML.prototype.cookie = function(name, value) {
|
689
|
-
var date, match;
|
690
|
-
if (value == null) {
|
691
|
-
value = void 0;
|
692
|
-
}
|
693
|
-
if (value === void 0) {
|
694
|
-
name = name.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
695
|
-
match = document.cookie.match(new RegExp("(?:^|;)\\s?" + name + "=(.*?)(?:;|$)", "i"));
|
696
|
-
return match && JSON.parse(unescape(match[1]).split(" ")[0]);
|
697
|
-
} else {
|
698
|
-
date = new Teaspoon.Date();
|
699
|
-
date.setDate(date.getDate() + 365);
|
700
|
-
return document.cookie = name + "=" + (escape(JSON.stringify(value))) + "; expires=" + (date.toUTCString()) + "; path=/;";
|
701
|
-
}
|
702
|
-
};
|
703
|
-
|
704
|
-
HTML.prototype.localstore = function(name, value) {
|
705
|
-
if (value == null) {
|
706
|
-
value = void 0;
|
707
|
-
}
|
708
|
-
if (value === void 0) {
|
709
|
-
return JSON.parse(unescape(localStorage.getItem(name)));
|
710
|
-
} else {
|
711
|
-
return localStorage.setItem(name, escape(JSON.stringify(value)));
|
712
|
-
}
|
713
|
-
};
|
714
|
-
|
715
|
-
return HTML;
|
716
|
-
|
717
|
-
})(Teaspoon.Reporters.BaseView);
|
718
|
-
|
719
|
-
}).call(this);
|
720
|
-
(function() {
|
721
|
-
var extend = 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; },
|
722
|
-
hasProp = {}.hasOwnProperty;
|
723
|
-
|
724
|
-
Teaspoon.Reporters.HTML.ProgressView = (function(superClass) {
|
725
|
-
extend(ProgressView, superClass);
|
726
|
-
|
727
|
-
function ProgressView() {
|
728
|
-
return ProgressView.__super__.constructor.apply(this, arguments);
|
729
|
-
}
|
730
|
-
|
731
|
-
ProgressView.create = function(displayProgress) {
|
732
|
-
if (displayProgress == null) {
|
733
|
-
displayProgress = true;
|
734
|
-
}
|
735
|
-
if (!displayProgress) {
|
736
|
-
return new Teaspoon.Reporters.HTML.ProgressView();
|
737
|
-
}
|
738
|
-
if (Teaspoon.Reporters.HTML.RadialProgressView.supported) {
|
739
|
-
return new Teaspoon.Reporters.HTML.RadialProgressView();
|
740
|
-
} else {
|
741
|
-
return new Teaspoon.Reporters.HTML.SimpleProgressView();
|
742
|
-
}
|
743
|
-
};
|
744
|
-
|
745
|
-
ProgressView.prototype.build = function() {
|
746
|
-
return this.el = this.createEl("div", "teaspoon-indicator teaspoon-logo");
|
747
|
-
};
|
748
|
-
|
749
|
-
ProgressView.prototype.update = function() {};
|
750
|
-
|
751
|
-
return ProgressView;
|
752
|
-
|
753
|
-
})(Teaspoon.Reporters.BaseView);
|
754
|
-
|
755
|
-
Teaspoon.Reporters.HTML.SimpleProgressView = (function(superClass) {
|
756
|
-
extend(SimpleProgressView, superClass);
|
757
|
-
|
758
|
-
function SimpleProgressView() {
|
759
|
-
return SimpleProgressView.__super__.constructor.apply(this, arguments);
|
760
|
-
}
|
761
|
-
|
762
|
-
SimpleProgressView.prototype.build = function() {
|
763
|
-
this.el = this.createEl("div", "simple-progress");
|
764
|
-
return this.el.innerHTML = "<em id=\"teaspoon-progress-percent\">0%</em>\n<span id=\"teaspoon-progress-span\" class=\"teaspoon-indicator\"></span>";
|
765
|
-
};
|
766
|
-
|
767
|
-
SimpleProgressView.prototype.update = function(total, run) {
|
768
|
-
var percent;
|
769
|
-
percent = total ? Math.ceil((run * 100) / total) : 0;
|
770
|
-
return this.setHtml("progress-percent", percent + "%");
|
771
|
-
};
|
772
|
-
|
773
|
-
return SimpleProgressView;
|
774
|
-
|
775
|
-
})(Teaspoon.Reporters.HTML.ProgressView);
|
776
|
-
|
777
|
-
Teaspoon.Reporters.HTML.RadialProgressView = (function(superClass) {
|
778
|
-
extend(RadialProgressView, superClass);
|
779
|
-
|
780
|
-
function RadialProgressView() {
|
781
|
-
return RadialProgressView.__super__.constructor.apply(this, arguments);
|
782
|
-
}
|
783
|
-
|
784
|
-
RadialProgressView.supported = !!document.createElement("canvas").getContext;
|
785
|
-
|
786
|
-
RadialProgressView.prototype.build = function() {
|
787
|
-
this.el = this.createEl("div", "teaspoon-indicator radial-progress");
|
788
|
-
return this.el.innerHTML = "<canvas id=\"teaspoon-progress-canvas\"></canvas>\n<em id=\"teaspoon-progress-percent\">0%</em>";
|
789
|
-
};
|
790
|
-
|
791
|
-
RadialProgressView.prototype.appendTo = function() {
|
792
|
-
var canvas, e;
|
793
|
-
RadialProgressView.__super__.appendTo.apply(this, arguments);
|
794
|
-
this.size = 80;
|
795
|
-
try {
|
796
|
-
canvas = this.findEl("progress-canvas");
|
797
|
-
canvas.width = canvas.height = canvas.style.width = canvas.style.height = this.size;
|
798
|
-
this.ctx = canvas.getContext("2d");
|
799
|
-
this.ctx.strokeStyle = "#fff";
|
800
|
-
return this.ctx.lineWidth = 1.5;
|
801
|
-
} catch (_error) {
|
802
|
-
e = _error;
|
803
|
-
}
|
804
|
-
};
|
805
|
-
|
806
|
-
RadialProgressView.prototype.update = function(total, run) {
|
807
|
-
var half, percent;
|
808
|
-
percent = total ? Math.ceil((run * 100) / total) : 0;
|
809
|
-
this.setHtml("progress-percent", percent + "%");
|
810
|
-
if (!this.ctx) {
|
811
|
-
return;
|
812
|
-
}
|
813
|
-
half = this.size / 2;
|
814
|
-
this.ctx.clearRect(0, 0, this.size, this.size);
|
815
|
-
this.ctx.beginPath();
|
816
|
-
this.ctx.arc(half, half, half - 1, 0, Math.PI * 2 * (percent / 100), false);
|
817
|
-
return this.ctx.stroke();
|
818
|
-
};
|
819
|
-
|
820
|
-
return RadialProgressView;
|
821
|
-
|
822
|
-
})(Teaspoon.Reporters.HTML.ProgressView);
|
823
|
-
|
824
|
-
}).call(this);
|
825
|
-
(function() {
|
826
|
-
var extend = 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; },
|
827
|
-
hasProp = {}.hasOwnProperty;
|
828
|
-
|
829
|
-
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
830
|
-
var viewId;
|
831
|
-
|
832
|
-
extend(SpecView, superClass);
|
833
|
-
|
834
|
-
viewId = 0;
|
835
|
-
|
836
|
-
function SpecView(spec, reporter) {
|
837
|
-
this.spec = spec;
|
838
|
-
this.reporter = reporter;
|
839
|
-
this.views = this.reporter.views;
|
840
|
-
this.spec.viewId = viewId += 1;
|
841
|
-
this.views.specs[this.spec.viewId] = this;
|
842
|
-
SpecView.__super__.constructor.apply(this, arguments);
|
843
|
-
}
|
844
|
-
|
845
|
-
SpecView.prototype.build = function() {
|
846
|
-
var classes;
|
847
|
-
classes = ["spec"];
|
848
|
-
if (this.spec.pending) {
|
849
|
-
classes.push("state-pending");
|
850
|
-
}
|
851
|
-
SpecView.__super__.build.call(this, classes.join(" "));
|
852
|
-
this.el.innerHTML = "<a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.description)) + "</a>";
|
853
|
-
this.parentView = this.buildParent();
|
854
|
-
return this.parentView.append(this.el);
|
855
|
-
};
|
856
|
-
|
857
|
-
SpecView.prototype.buildParent = function() {
|
858
|
-
var parent, view;
|
859
|
-
parent = this.spec.parent;
|
860
|
-
if (parent.viewId) {
|
861
|
-
return this.views.suites[parent.viewId];
|
862
|
-
} else {
|
863
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, this.reporter);
|
864
|
-
return this.views.suites[view.suite.viewId] = view;
|
865
|
-
}
|
866
|
-
};
|
867
|
-
|
868
|
-
SpecView.prototype.buildErrors = function() {
|
869
|
-
var div, error, html, i, len, ref;
|
870
|
-
div = this.createEl("div");
|
871
|
-
html = "";
|
872
|
-
ref = this.spec.errors();
|
873
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
874
|
-
error = ref[i];
|
875
|
-
html += "<strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable"));
|
876
|
-
}
|
877
|
-
div.innerHTML = html;
|
878
|
-
return this.append(div);
|
879
|
-
};
|
880
|
-
|
881
|
-
SpecView.prototype.updateState = function(state, elapsed) {
|
882
|
-
var base, classes, result;
|
883
|
-
result = this.spec.result();
|
884
|
-
classes = ["state-" + state];
|
885
|
-
if (elapsed > Teaspoon.slow) {
|
886
|
-
classes.push("slow");
|
887
|
-
}
|
888
|
-
if (state !== "failed") {
|
889
|
-
this.el.innerHTML += "<span>" + elapsed + "ms</span>";
|
890
|
-
}
|
891
|
-
this.el.className = classes.join(" ");
|
892
|
-
if (result.status !== "passed") {
|
893
|
-
this.buildErrors();
|
894
|
-
}
|
895
|
-
return typeof (base = this.parentView).updateState === "function" ? base.updateState(state) : void 0;
|
896
|
-
};
|
897
|
-
|
898
|
-
return SpecView;
|
899
|
-
|
900
|
-
})(Teaspoon.Reporters.BaseView);
|
901
|
-
|
902
|
-
}).call(this);
|
903
|
-
(function() {
|
904
|
-
var extend = 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; },
|
905
|
-
hasProp = {}.hasOwnProperty;
|
906
|
-
|
907
|
-
Teaspoon.Reporters.HTML.FailureView = (function(superClass) {
|
908
|
-
extend(FailureView, superClass);
|
909
|
-
|
910
|
-
function FailureView(spec) {
|
911
|
-
this.spec = spec;
|
912
|
-
FailureView.__super__.constructor.apply(this, arguments);
|
913
|
-
}
|
914
|
-
|
915
|
-
FailureView.prototype.build = function() {
|
916
|
-
var error, html, i, len, ref;
|
917
|
-
FailureView.__super__.build.call(this, "spec");
|
918
|
-
html = "<h1 class=\"teaspoon-clearfix\"><a href=\"" + this.spec.link + "\">" + (this.htmlSafe(this.spec.fullDescription)) + "</a></h1>";
|
919
|
-
ref = this.spec.errors();
|
920
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
921
|
-
error = ref[i];
|
922
|
-
html += "<div><strong>" + (this.htmlSafe(error.message)) + "</strong><br/>" + (this.htmlSafe(error.stack || "Stack trace unavailable")) + "</div>";
|
923
|
-
}
|
924
|
-
return this.el.innerHTML = html;
|
925
|
-
};
|
926
|
-
|
927
|
-
return FailureView;
|
928
|
-
|
929
|
-
})(Teaspoon.Reporters.BaseView);
|
930
|
-
|
931
|
-
}).call(this);
|
932
|
-
(function() {
|
933
|
-
var extend = 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; },
|
934
|
-
hasProp = {}.hasOwnProperty;
|
935
|
-
|
936
|
-
Teaspoon.Reporters.HTML.SuiteView = (function(superClass) {
|
937
|
-
var viewId;
|
938
|
-
|
939
|
-
extend(SuiteView, superClass);
|
940
|
-
|
941
|
-
viewId = 0;
|
942
|
-
|
943
|
-
function SuiteView(suite, reporter) {
|
944
|
-
this.suite = suite;
|
945
|
-
this.reporter = reporter;
|
946
|
-
this.views = this.reporter.views;
|
947
|
-
this.suite.viewId = viewId += 1;
|
948
|
-
this.views.suites[this.suite.viewId] = this;
|
949
|
-
this.suite = new Teaspoon.Suite(this.suite);
|
950
|
-
SuiteView.__super__.constructor.apply(this, arguments);
|
951
|
-
}
|
952
|
-
|
953
|
-
SuiteView.prototype.build = function() {
|
954
|
-
SuiteView.__super__.build.call(this, "suite");
|
955
|
-
this.el.innerHTML = "<h1><a href=\"" + this.suite.link + "\">" + (this.htmlSafe(this.suite.description)) + "</a></h1>";
|
956
|
-
this.parentView = this.buildParent();
|
957
|
-
return this.parentView.append(this.el);
|
958
|
-
};
|
959
|
-
|
960
|
-
SuiteView.prototype.buildParent = function() {
|
961
|
-
var parent, view;
|
962
|
-
parent = this.suite.parent;
|
963
|
-
if (!parent) {
|
964
|
-
return this.reporter;
|
965
|
-
}
|
966
|
-
if (parent.viewId) {
|
967
|
-
return this.views.suites[parent.viewId];
|
968
|
-
} else {
|
969
|
-
view = new Teaspoon.Reporters.HTML.SuiteView(parent, this.reporter);
|
970
|
-
return this.views.suites[view.suite.viewId] = view;
|
971
|
-
}
|
972
|
-
};
|
973
|
-
|
974
|
-
SuiteView.prototype.append = function(el) {
|
975
|
-
if (!this.ol) {
|
976
|
-
SuiteView.__super__.append.call(this, this.ol = this.createEl("ol"));
|
977
|
-
}
|
978
|
-
return this.ol.appendChild(el);
|
979
|
-
};
|
980
|
-
|
981
|
-
SuiteView.prototype.updateState = function(state) {
|
982
|
-
var base;
|
983
|
-
if (this.state === "failed") {
|
984
|
-
return;
|
985
|
-
}
|
986
|
-
this.el.className = (this.el.className.replace(/\s?state-\w+/, "")) + " state-" + state;
|
987
|
-
if (typeof (base = this.parentView).updateState === "function") {
|
988
|
-
base.updateState(state);
|
989
|
-
}
|
990
|
-
return this.state = state;
|
991
|
-
};
|
992
|
-
|
993
|
-
return SuiteView;
|
994
|
-
|
995
|
-
})(Teaspoon.Reporters.BaseView);
|
996
|
-
|
997
|
-
}).call(this);
|
998
|
-
(function() {
|
999
|
-
Teaspoon.Reporters.HTML.template = function() {
|
1000
|
-
return "<div class=\"teaspoon-clearfix\">\n <div id=\"teaspoon-title\">\n <h1><a href=\"" + Teaspoon.root + "\" id=\"teaspoon-root-link\">Teaspoon</a></h1>\n <ul>\n <li>version: <b id=\"teaspoon-version\"></b></li>\n <li id=\"teaspoon-env-info\"></li>\n </ul>\n </div>\n <div id=\"teaspoon-progress\"></div>\n <ul id=\"teaspoon-stats\">\n <li>passes: <b id=\"teaspoon-stats-passes\">0</b></li>\n <li>failures: <b id=\"teaspoon-stats-failures\">0</b></li>\n <li>skipped: <b id=\"teaspoon-stats-skipped\">0</b></li>\n <li>duration: <b id=\"teaspoon-stats-duration\">∞</b></li>\n </ul>\n</div>\n\n<div id=\"teaspoon-controls\" class=\"teaspoon-clearfix\">\n <div id=\"teaspoon-toggles\">\n <button id=\"teaspoon-use-catch\" title=\"Toggle using try/catch wrappers when possible\">Try/Catch</button>\n <button id=\"teaspoon-build-full-report\" title=\"Toggle building the full report\">Full Report</button>\n <button id=\"teaspoon-display-progress\" title=\"Toggle displaying progress as tests run\">Progress</button>\n </div>\n <div id=\"teaspoon-suites\"></div>\n</div>\n\n<hr/>\n\n<div id=\"teaspoon-filter\">\n <h1>Applied Filters [<a href=\"" + window.location.pathname + "\" id=\"teaspoon-filter-clear\">remove</a>]</h1>\n <ul id=\"teaspoon-filter-list\"></ul>\n</div>\n\n<div id=\"teaspoon-report\">\n <ol id=\"teaspoon-report-failures\"></ol>\n <ol id=\"teaspoon-report-all\"></ol>\n</div>";
|
1001
|
-
};
|
1002
|
-
|
1003
|
-
}).call(this);
|
1004
|
-
(function() {
|
1005
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
1006
|
-
|
1007
|
-
Teaspoon.Reporters.Console = (function() {
|
1008
|
-
function Console() {
|
1009
|
-
this.reportRunnerResults = bind(this.reportRunnerResults, this);
|
1010
|
-
this.start = new Teaspoon.Date();
|
1011
|
-
this.suites = {};
|
1012
|
-
}
|
1013
|
-
|
1014
|
-
Console.prototype.reportRunnerStarting = function(runner) {
|
1015
|
-
return this.log({
|
1016
|
-
type: "runner",
|
1017
|
-
total: runner.total || (typeof runner.specs === "function" ? runner.specs().length : void 0) || 0,
|
1018
|
-
start: JSON.parse(JSON.stringify(this.start))
|
1019
|
-
});
|
1020
|
-
};
|
1021
|
-
|
1022
|
-
Console.prototype.reportSuites = function() {
|
1023
|
-
var i, index, len, ref, results, suite;
|
1024
|
-
ref = this.spec.getParents();
|
1025
|
-
results = [];
|
1026
|
-
for (index = i = 0, len = ref.length; i < len; index = ++i) {
|
1027
|
-
suite = ref[index];
|
1028
|
-
if (this.suites[suite.fullDescription]) {
|
1029
|
-
continue;
|
1030
|
-
}
|
1031
|
-
this.suites[suite.fullDescription] = true;
|
1032
|
-
results.push(this.log({
|
1033
|
-
type: "suite",
|
1034
|
-
label: suite.description,
|
1035
|
-
level: index
|
1036
|
-
}));
|
1037
|
-
}
|
1038
|
-
return results;
|
1039
|
-
};
|
1040
|
-
|
1041
|
-
Console.prototype.reportSpecResults = function(spec) {
|
1042
|
-
var result;
|
1043
|
-
this.spec = new Teaspoon.Spec(spec);
|
1044
|
-
result = this.spec.result();
|
1045
|
-
if (result.skipped) {
|
1046
|
-
return;
|
1047
|
-
}
|
1048
|
-
this.reportSuites();
|
1049
|
-
switch (result.status) {
|
1050
|
-
case "pending":
|
1051
|
-
return this.trackPending();
|
1052
|
-
case "failed":
|
1053
|
-
return this.trackFailure();
|
1054
|
-
default:
|
1055
|
-
return this.log({
|
1056
|
-
type: "spec",
|
1057
|
-
suite: this.spec.suiteName,
|
1058
|
-
label: this.spec.description,
|
1059
|
-
status: result.status,
|
1060
|
-
skipped: result.skipped
|
1061
|
-
});
|
1062
|
-
}
|
1063
|
-
};
|
1064
|
-
|
1065
|
-
Console.prototype.trackPending = function() {
|
1066
|
-
var result;
|
1067
|
-
result = this.spec.result();
|
1068
|
-
return this.log({
|
1069
|
-
type: "spec",
|
1070
|
-
suite: this.spec.suiteName,
|
1071
|
-
label: this.spec.description,
|
1072
|
-
status: result.status,
|
1073
|
-
skipped: result.skipped
|
1074
|
-
});
|
1075
|
-
};
|
1076
|
-
|
1077
|
-
Console.prototype.trackFailure = function() {
|
1078
|
-
var error, i, len, ref, result, results;
|
1079
|
-
result = this.spec.result();
|
1080
|
-
ref = this.spec.errors();
|
1081
|
-
results = [];
|
1082
|
-
for (i = 0, len = ref.length; i < len; i++) {
|
1083
|
-
error = ref[i];
|
1084
|
-
results.push(this.log({
|
1085
|
-
type: "spec",
|
1086
|
-
suite: this.spec.suiteName,
|
1087
|
-
label: this.spec.description,
|
1088
|
-
status: result.status,
|
1089
|
-
skipped: result.skipped,
|
1090
|
-
link: this.spec.fullDescription,
|
1091
|
-
message: error.message,
|
1092
|
-
trace: error.stack || error.message || "Stack Trace Unavailable"
|
1093
|
-
}));
|
1094
|
-
}
|
1095
|
-
return results;
|
1096
|
-
};
|
1097
|
-
|
1098
|
-
Console.prototype.reportRunnerResults = function() {
|
1099
|
-
this.log({
|
1100
|
-
type: "result",
|
1101
|
-
elapsed: ((new Teaspoon.Date().getTime() - this.start.getTime()) / 1000).toFixed(5),
|
1102
|
-
coverage: window.__coverage__
|
1103
|
-
});
|
1104
|
-
return Teaspoon.finished = true;
|
1105
|
-
};
|
1106
|
-
|
1107
|
-
Console.prototype.log = function(obj) {
|
1108
|
-
if (obj == null) {
|
1109
|
-
obj = {};
|
1110
|
-
}
|
1111
|
-
obj["_teaspoon"] = true;
|
1112
|
-
return Teaspoon.log(JSON.stringify(obj));
|
1113
|
-
};
|
1114
|
-
|
1115
|
-
return Console;
|
1116
|
-
|
1117
|
-
})();
|
1118
|
-
|
1119
|
-
}).call(this);
|
1120
|
-
(function() {
|
1121
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1122
|
-
extend = 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; },
|
1123
|
-
hasProp = {}.hasOwnProperty;
|
1124
|
-
|
1125
|
-
Teaspoon.Reporters.Console = (function(superClass) {
|
1126
|
-
extend(Console, superClass);
|
1127
|
-
|
1128
|
-
function Console(runner) {
|
1129
|
-
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1130
|
-
Console.__super__.constructor.apply(this, arguments);
|
1131
|
-
this.reportRunnerStarting(runner);
|
1132
|
-
runner.on("fail", this.reportSpecResults);
|
1133
|
-
runner.on("test end", this.reportSpecResults);
|
1134
|
-
runner.on("end", this.reportRunnerResults);
|
1135
|
-
}
|
1136
|
-
|
1137
|
-
Console.prototype.reportSpecResults = function(spec, err) {
|
1138
|
-
if (err) {
|
1139
|
-
spec.err = err;
|
1140
|
-
if (spec.type === "hook") {
|
1141
|
-
this.reportSpecResults(spec);
|
1142
|
-
}
|
1143
|
-
return;
|
1144
|
-
}
|
1145
|
-
return Console.__super__.reportSpecResults.apply(this, arguments);
|
1146
|
-
};
|
1147
|
-
|
1148
|
-
return Console;
|
1149
|
-
|
1150
|
-
})(Teaspoon.Reporters.Console);
|
1151
|
-
|
1152
|
-
}).call(this);
|
1153
|
-
(function() {
|
1154
|
-
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
1155
|
-
extend = 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; },
|
1156
|
-
hasProp = {}.hasOwnProperty;
|
1157
|
-
|
1158
|
-
Teaspoon.Reporters.HTML = (function(superClass) {
|
1159
|
-
extend(HTML, superClass);
|
1160
|
-
|
1161
|
-
function HTML(runner) {
|
1162
|
-
this.reportSpecResults = bind(this.reportSpecResults, this);
|
1163
|
-
HTML.__super__.constructor.apply(this, arguments);
|
1164
|
-
this.reportRunnerStarting(runner);
|
1165
|
-
runner.on("fail", this.reportSpecResults);
|
1166
|
-
runner.on("test end", this.reportSpecResults);
|
1167
|
-
runner.on("end", this.reportRunnerResults);
|
1168
|
-
}
|
1169
|
-
|
1170
|
-
HTML.prototype.reportSpecResults = function(spec, err) {
|
1171
|
-
if (err) {
|
1172
|
-
spec.err = err;
|
1173
|
-
if (spec.type === "hook") {
|
1174
|
-
this.reportSpecResults(spec);
|
1175
|
-
}
|
1176
|
-
return;
|
1177
|
-
}
|
1178
|
-
this.reportSpecStarting(spec);
|
1179
|
-
return HTML.__super__.reportSpecResults.apply(this, arguments);
|
1180
|
-
};
|
1181
|
-
|
1182
|
-
HTML.prototype.envInfo = function() {
|
1183
|
-
return "mocha " + (_mocha_version || "[unknown version]");
|
1184
|
-
};
|
1185
|
-
|
1186
|
-
return HTML;
|
1187
|
-
|
1188
|
-
})(Teaspoon.Reporters.HTML);
|
1189
|
-
|
1190
|
-
Teaspoon.Reporters.HTML.SpecView = (function(superClass) {
|
1191
|
-
extend(SpecView, superClass);
|
1192
|
-
|
1193
|
-
function SpecView() {
|
1194
|
-
return SpecView.__super__.constructor.apply(this, arguments);
|
1195
|
-
}
|
1196
|
-
|
1197
|
-
SpecView.prototype.updateState = function(state) {
|
1198
|
-
return SpecView.__super__.updateState.call(this, state, this.spec.spec.duration);
|
1199
|
-
};
|
1200
|
-
|
1201
|
-
return SpecView;
|
1202
|
-
|
1203
|
-
})(Teaspoon.Reporters.HTML.SpecView);
|
1204
|
-
|
1205
|
-
}).call(this);
|
1206
|
-
(function() {
|
1207
|
-
var env,
|
1208
|
-
extend = 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; },
|
1209
|
-
hasProp = {}.hasOwnProperty;
|
1210
|
-
|
1211
|
-
if (typeof mocha === "undefined" || mocha === null) {
|
1212
|
-
throw new Teaspoon.Error('Mocha not found -- use `suite.use_framework :mocha` and adjust or remove the `suite.javascripts` directive.');
|
1213
|
-
}
|
1214
|
-
|
1215
|
-
Teaspoon.Runner = (function(superClass) {
|
1216
|
-
extend(Runner, superClass);
|
1217
|
-
|
1218
|
-
function Runner() {
|
1219
|
-
Runner.__super__.constructor.apply(this, arguments);
|
1220
|
-
env.run();
|
1221
|
-
env.started = true;
|
1222
|
-
afterEach(function() {
|
1223
|
-
return Teaspoon.fixture.cleanup();
|
1224
|
-
});
|
1225
|
-
}
|
1226
|
-
|
1227
|
-
Runner.prototype.setup = function() {
|
1228
|
-
var reporter;
|
1229
|
-
reporter = this.getReporter();
|
1230
|
-
return env.setup({
|
1231
|
-
reporter: reporter
|
1232
|
-
});
|
1233
|
-
};
|
1234
|
-
|
1235
|
-
return Runner;
|
1236
|
-
|
1237
|
-
})(Teaspoon.Runner);
|
1238
|
-
|
1239
|
-
Teaspoon.Spec = (function() {
|
1240
|
-
function Spec(spec) {
|
1241
|
-
this.spec = spec;
|
1242
|
-
this.fullDescription = this.spec.fullTitle();
|
1243
|
-
this.description = this.spec.title;
|
1244
|
-
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
1245
|
-
this.parent = this.spec.parent;
|
1246
|
-
this.suiteName = this.parent.fullTitle();
|
1247
|
-
this.viewId = this.spec.viewId;
|
1248
|
-
this.pending = this.spec.pending;
|
1249
|
-
}
|
1250
|
-
|
1251
|
-
Spec.prototype.errors = function() {
|
1252
|
-
if (!this.spec.err) {
|
1253
|
-
return [];
|
1254
|
-
}
|
1255
|
-
return [this.spec.err];
|
1256
|
-
};
|
1257
|
-
|
1258
|
-
Spec.prototype.getParents = function() {
|
1259
|
-
var parent;
|
1260
|
-
if (this.parents) {
|
1261
|
-
return this.parents;
|
1262
|
-
}
|
1263
|
-
this.parents || (this.parents = []);
|
1264
|
-
parent = this.parent;
|
1265
|
-
while (parent) {
|
1266
|
-
parent = new Teaspoon.Suite(parent);
|
1267
|
-
this.parents.unshift(parent);
|
1268
|
-
parent = parent.parent;
|
1269
|
-
}
|
1270
|
-
return this.parents;
|
1271
|
-
};
|
1272
|
-
|
1273
|
-
Spec.prototype.result = function() {
|
1274
|
-
var status;
|
1275
|
-
status = "failed";
|
1276
|
-
if (this.spec.state === "passed" || this.spec.state === "skipped") {
|
1277
|
-
status = "passed";
|
1278
|
-
}
|
1279
|
-
if (this.spec.pending) {
|
1280
|
-
status = "pending";
|
1281
|
-
}
|
1282
|
-
return {
|
1283
|
-
status: status,
|
1284
|
-
skipped: this.spec.state === "skipped"
|
1285
|
-
};
|
1286
|
-
};
|
1287
|
-
|
1288
|
-
return Spec;
|
1289
|
-
|
1290
|
-
})();
|
1291
|
-
|
1292
|
-
Teaspoon.Suite = (function() {
|
1293
|
-
function Suite(suite) {
|
1294
|
-
var ref;
|
1295
|
-
this.suite = suite;
|
1296
|
-
this.fullDescription = this.suite.fullTitle();
|
1297
|
-
this.description = this.suite.title;
|
1298
|
-
this.link = "?grep=" + (encodeURIComponent(this.fullDescription));
|
1299
|
-
this.parent = ((ref = this.suite.parent) != null ? ref.root : void 0) ? null : this.suite.parent;
|
1300
|
-
this.viewId = this.suite.viewId;
|
1301
|
-
}
|
1302
|
-
|
1303
|
-
return Suite;
|
1304
|
-
|
1305
|
-
})();
|
1306
|
-
|
1307
|
-
Teaspoon.fixture = (function(superClass) {
|
1308
|
-
extend(fixture, superClass);
|
1309
|
-
|
1310
|
-
function fixture() {
|
1311
|
-
return fixture.__super__.constructor.apply(this, arguments);
|
1312
|
-
}
|
1313
|
-
|
1314
|
-
window.fixture = fixture;
|
1315
|
-
|
1316
|
-
fixture.load = function() {
|
1317
|
-
var args;
|
1318
|
-
args = arguments;
|
1319
|
-
if (env.started) {
|
1320
|
-
return fixture.__super__.constructor.load.apply(this, arguments);
|
1321
|
-
} else {
|
1322
|
-
return beforeEach((function(_this) {
|
1323
|
-
return function() {
|
1324
|
-
return fixture.__super__.constructor.load.apply(_this, args);
|
1325
|
-
};
|
1326
|
-
})(this));
|
1327
|
-
}
|
1328
|
-
};
|
1329
|
-
|
1330
|
-
fixture.set = function() {
|
1331
|
-
var args;
|
1332
|
-
args = arguments;
|
1333
|
-
if (env.started) {
|
1334
|
-
return fixture.__super__.constructor.set.apply(this, arguments);
|
1335
|
-
} else {
|
1336
|
-
return beforeEach((function(_this) {
|
1337
|
-
return function() {
|
1338
|
-
return fixture.__super__.constructor.set.apply(_this, args);
|
1339
|
-
};
|
1340
|
-
})(this));
|
1341
|
-
}
|
1342
|
-
};
|
1343
|
-
|
1344
|
-
return fixture;
|
1345
|
-
|
1346
|
-
})(Teaspoon.fixture);
|
1347
|
-
|
1348
|
-
env = mocha.setup("bdd");
|
1349
|
-
|
1350
|
-
}).call(this);
|