simple_pvr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/README.md +19 -12
- data/Rakefile +4 -1
- data/lib/simple_pvr/version.rb +1 -1
- data/test/testacular.conf.js +18 -0
- data/test/{filtersSpec.js → unit/filtersSpec.js} +0 -0
- metadata +8 -44
- data/test/config/jsTestDriver-scenario.conf +0 -10
- data/test/config/jsTestDriver.conf +0 -12
- data/test/config/jstd-scenario-adapter-config.js +0 -6
- data/test/lib/angular/angular-scenario.js +0 -25937
- data/test/lib/angular/jstd-scenario-adapter.js +0 -185
- data/test/lib/angular/version.txt +0 -1
- data/test/lib/jasmine-jstd-adapter/JasmineAdapter.js +0 -196
- data/test/lib/jasmine-jstd-adapter/version.txt +0 -1
- data/test/lib/jasmine/MIT.LICENSE +0 -20
- data/test/lib/jasmine/index.js +0 -180
- data/test/lib/jasmine/jasmine-html.js +0 -190
- data/test/lib/jasmine/jasmine.css +0 -166
- data/test/lib/jasmine/jasmine.js +0 -2476
- data/test/lib/jasmine/jasmine_favicon.png +0 -0
- data/test/lib/jasmine/version.txt +0 -1
- data/test/lib/jstestdriver/JsTestDriver.jar +0 -0
- data/test/lib/jstestdriver/version.txt +0 -1
- data/test/scripts/test-server.sh +0 -14
- data/test/scripts/test.sh +0 -8
@@ -1,185 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license AngularJS v1.0.0rc1
|
3
|
-
* (c) 2010-2011 AngularJS http://angularjs.org
|
4
|
-
* License: MIT
|
5
|
-
*/
|
6
|
-
(function(window) {
|
7
|
-
'use strict';
|
8
|
-
|
9
|
-
/**
|
10
|
-
* JSTestDriver adapter for angular scenario tests
|
11
|
-
*
|
12
|
-
* Example of jsTestDriver.conf for running scenario tests with JSTD:
|
13
|
-
<pre>
|
14
|
-
server: http://localhost:9877
|
15
|
-
|
16
|
-
load:
|
17
|
-
- lib/angular-scenario.js
|
18
|
-
- lib/jstd-scenario-adapter-config.js
|
19
|
-
- lib/jstd-scenario-adapter.js
|
20
|
-
# your test files go here #
|
21
|
-
|
22
|
-
proxy:
|
23
|
-
- {matcher: "/your-prefix/*", server: "http://localhost:8000/"}
|
24
|
-
</pre>
|
25
|
-
*
|
26
|
-
* For more information on how to configure jstd proxy, see {@link http://code.google.com/p/js-test-driver/wiki/Proxy}
|
27
|
-
* Note the order of files - it's important !
|
28
|
-
*
|
29
|
-
* Example of jstd-scenario-adapter-config.js
|
30
|
-
<pre>
|
31
|
-
var jstdScenarioAdapter = {
|
32
|
-
relativeUrlPrefix: '/your-prefix/'
|
33
|
-
};
|
34
|
-
</pre>
|
35
|
-
*
|
36
|
-
* Whenever you use <code>browser().navigateTo('relativeUrl')</code> in your scenario test, the relativeUrlPrefix will be prepended.
|
37
|
-
* You have to configure this to work together with JSTD proxy.
|
38
|
-
*
|
39
|
-
* Let's assume you are using the above configuration (jsTestDriver.conf and jstd-scenario-adapter-config.js):
|
40
|
-
* Now, when you call <code>browser().navigateTo('index.html')</code> in your scenario test, the browser will open /your-prefix/index.html.
|
41
|
-
* That matches the proxy, so JSTD will proxy this request to http://localhost:8000/index.html.
|
42
|
-
*/
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Custom type of test case
|
46
|
-
*
|
47
|
-
* @const
|
48
|
-
* @see jstestdriver.TestCaseInfo
|
49
|
-
*/
|
50
|
-
var SCENARIO_TYPE = 'scenario';
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Plugin for JSTestDriver
|
54
|
-
* Connection point between scenario's jstd output and jstestdriver.
|
55
|
-
*
|
56
|
-
* @see jstestdriver.PluginRegistrar
|
57
|
-
*/
|
58
|
-
function JstdPlugin() {
|
59
|
-
var nop = function() {};
|
60
|
-
|
61
|
-
this.reportResult = nop;
|
62
|
-
this.reportEnd = nop;
|
63
|
-
this.runScenario = nop;
|
64
|
-
|
65
|
-
this.name = 'Angular Scenario Adapter';
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Called for each JSTD TestCase
|
69
|
-
*
|
70
|
-
* Handles only SCENARIO_TYPE test cases. There should be only one fake TestCase.
|
71
|
-
* Runs all scenario tests (under one fake TestCase) and report all results to JSTD.
|
72
|
-
*
|
73
|
-
* @param {jstestdriver.TestRunConfiguration} configuration
|
74
|
-
* @param {Function} onTestDone
|
75
|
-
* @param {Function} onAllTestsComplete
|
76
|
-
* @returns {boolean} True if this type of test is handled by this plugin, false otherwise
|
77
|
-
*/
|
78
|
-
this.runTestConfiguration = function(configuration, onTestDone, onAllTestsComplete) {
|
79
|
-
if (configuration.getTestCaseInfo().getType() != SCENARIO_TYPE) return false;
|
80
|
-
|
81
|
-
this.reportResult = onTestDone;
|
82
|
-
this.reportEnd = onAllTestsComplete;
|
83
|
-
this.runScenario();
|
84
|
-
|
85
|
-
return true;
|
86
|
-
};
|
87
|
-
|
88
|
-
this.getTestRunsConfigurationFor = function(testCaseInfos, expressions, testRunsConfiguration) {
|
89
|
-
testRunsConfiguration.push(
|
90
|
-
new jstestdriver.TestRunConfiguration(
|
91
|
-
new jstestdriver.TestCaseInfo(
|
92
|
-
'Angular Scenario Tests', function() {}, SCENARIO_TYPE), []));
|
93
|
-
|
94
|
-
return true;
|
95
|
-
};
|
96
|
-
}
|
97
|
-
|
98
|
-
/**
|
99
|
-
* Singleton instance of the plugin
|
100
|
-
* Accessed using closure by:
|
101
|
-
* - jstd output (reports to this plugin)
|
102
|
-
* - initScenarioAdapter (register the plugin to jstd)
|
103
|
-
*/
|
104
|
-
var plugin = new JstdPlugin();
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Initialise scenario jstd-adapter
|
108
|
-
* (only if jstestdriver is defined)
|
109
|
-
*
|
110
|
-
* @param {Object} jstestdriver Undefined when run from browser (without jstd)
|
111
|
-
* @param {Function} initScenarioAndRun Function that inits scenario and runs all the tests
|
112
|
-
* @param {Object=} config Configuration object, supported properties:
|
113
|
-
* - relativeUrlPrefix: prefix for all relative links when navigateTo()
|
114
|
-
*/
|
115
|
-
function initScenarioAdapter(jstestdriver, initScenarioAndRun, config) {
|
116
|
-
if (jstestdriver) {
|
117
|
-
// create and register ScenarioPlugin
|
118
|
-
jstestdriver.pluginRegistrar.register(plugin);
|
119
|
-
plugin.runScenario = initScenarioAndRun;
|
120
|
-
|
121
|
-
/**
|
122
|
-
* HACK (angular.scenario.Application.navigateTo)
|
123
|
-
*
|
124
|
-
* We need to navigate to relative urls when running from browser (without JSTD),
|
125
|
-
* because we want to allow running scenario tests without creating its own virtual host.
|
126
|
-
* For example: http://angular.local/build/docs/docs-scenario.html
|
127
|
-
*
|
128
|
-
* On the other hand, when running with JSTD, we need to navigate to absolute urls,
|
129
|
-
* because of JSTD proxy. (proxy, because of same domain policy)
|
130
|
-
*
|
131
|
-
* So this hack is applied only if running with JSTD and change all relative urls to absolute.
|
132
|
-
*/
|
133
|
-
var appProto = angular.scenario.Application.prototype,
|
134
|
-
navigateTo = appProto.navigateTo,
|
135
|
-
relativeUrlPrefix = config && config.relativeUrlPrefix || '/';
|
136
|
-
|
137
|
-
appProto.navigateTo = function(url, loadFn, errorFn) {
|
138
|
-
if (url.charAt(0) != '/' && url.charAt(0) != '#' &&
|
139
|
-
url != 'about:blank' && !url.match(/^https?/)) {
|
140
|
-
url = relativeUrlPrefix + url;
|
141
|
-
}
|
142
|
-
|
143
|
-
return navigateTo.call(this, url, loadFn, errorFn);
|
144
|
-
};
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
/**
|
149
|
-
* Builds proper TestResult object from given model spec
|
150
|
-
*
|
151
|
-
* TODO(vojta) report error details
|
152
|
-
*
|
153
|
-
* @param {angular.scenario.ObjectModel.Spec} spec
|
154
|
-
* @returns {jstestdriver.TestResult}
|
155
|
-
*/
|
156
|
-
function createTestResultFromSpec(spec) {
|
157
|
-
var map = {
|
158
|
-
success: 'PASSED',
|
159
|
-
error: 'ERROR',
|
160
|
-
failure: 'FAILED'
|
161
|
-
};
|
162
|
-
|
163
|
-
return new jstestdriver.TestResult(
|
164
|
-
spec.fullDefinitionName,
|
165
|
-
spec.name,
|
166
|
-
jstestdriver.TestResult.RESULT[map[spec.status]],
|
167
|
-
spec.error || '',
|
168
|
-
spec.line || '',
|
169
|
-
spec.duration);
|
170
|
-
}
|
171
|
-
|
172
|
-
/**
|
173
|
-
* Generates JSTD output (jstestdriver.TestResult)
|
174
|
-
*/
|
175
|
-
angular.scenario.output('jstd', function(context, runner, model) {
|
176
|
-
model.on('SpecEnd', function(spec) {
|
177
|
-
plugin.reportResult(createTestResultFromSpec(spec));
|
178
|
-
});
|
179
|
-
|
180
|
-
model.on('RunnerEnd', function() {
|
181
|
-
plugin.reportEnd();
|
182
|
-
});
|
183
|
-
});
|
184
|
-
initScenarioAdapter(window.jstestdriver, angular.scenario.setUpAndRun, window.jstdScenarioAdapter);
|
185
|
-
})(window);
|
@@ -1 +0,0 @@
|
|
1
|
-
1.0.1
|
@@ -1,196 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview Jasmine JsTestDriver Adapter.
|
3
|
-
* @author misko@hevery.com (Misko Hevery)
|
4
|
-
*/
|
5
|
-
(function(window) {
|
6
|
-
var rootDescribes = new Describes(window);
|
7
|
-
rootDescribes.collectMode();
|
8
|
-
|
9
|
-
var JASMINE_TYPE = 'jasmine test case';
|
10
|
-
TestCase('Jasmine Adapter Tests', null, JASMINE_TYPE);
|
11
|
-
|
12
|
-
var jasminePlugin = {
|
13
|
-
name:'jasmine',
|
14
|
-
|
15
|
-
getTestRunsConfigurationFor: function(testCaseInfos, expressions, testRunsConfiguration) {
|
16
|
-
for (var i = 0; i < testCaseInfos.length; i++) {
|
17
|
-
if (testCaseInfos[i].getType() == JASMINE_TYPE) {
|
18
|
-
testRunsConfiguration.push(new jstestdriver.TestRunConfiguration(testCaseInfos[i], []));
|
19
|
-
}
|
20
|
-
}
|
21
|
-
return false;
|
22
|
-
},
|
23
|
-
|
24
|
-
runTestConfiguration: function(testRunConfiguration, onTestDone, onTestRunConfigurationComplete) {
|
25
|
-
if (testRunConfiguration.getTestCaseInfo().getType() != JASMINE_TYPE) return false;
|
26
|
-
|
27
|
-
var jasmineEnv = jasmine.currentEnv_ = new jasmine.Env();
|
28
|
-
rootDescribes.playback();
|
29
|
-
var specLog = jstestdriver.console.log_ = [];
|
30
|
-
var start;
|
31
|
-
jasmineEnv.specFilter = function(spec) {
|
32
|
-
return rootDescribes.isExclusive(spec);
|
33
|
-
};
|
34
|
-
jasmineEnv.reporter = {
|
35
|
-
log: function(str) {
|
36
|
-
specLog.push(str);
|
37
|
-
},
|
38
|
-
|
39
|
-
reportRunnerStarting: function(runner) { },
|
40
|
-
|
41
|
-
reportSpecStarting: function(spec) {
|
42
|
-
specLog = jstestdriver.console.log_ = [];
|
43
|
-
start = new Date().getTime();
|
44
|
-
},
|
45
|
-
|
46
|
-
reportSpecResults: function(spec) {
|
47
|
-
var suite = spec.suite;
|
48
|
-
var results = spec.results();
|
49
|
-
if (results.skipped) return;
|
50
|
-
var end = new Date().getTime();
|
51
|
-
var messages = [];
|
52
|
-
var resultItems = results.getItems();
|
53
|
-
var state = 'passed';
|
54
|
-
for ( var i = 0; i < resultItems.length; i++) {
|
55
|
-
if (!resultItems[i].passed()) {
|
56
|
-
state = resultItems[i].message.match(/AssertionError:/) ? 'error' : 'failed';
|
57
|
-
messages.push({
|
58
|
-
message: resultItems[i].toString(),
|
59
|
-
name: resultItems[i].trace.name,
|
60
|
-
stack: formatStack(resultItems[i].trace.stack)
|
61
|
-
});
|
62
|
-
}
|
63
|
-
}
|
64
|
-
onTestDone(
|
65
|
-
new jstestdriver.TestResult(
|
66
|
-
suite.getFullName(),
|
67
|
-
spec.description,
|
68
|
-
state,
|
69
|
-
jstestdriver.angular.toJson(messages),
|
70
|
-
specLog.join('\n'),
|
71
|
-
end - start));
|
72
|
-
},
|
73
|
-
|
74
|
-
reportSuiteResults: function(suite) {},
|
75
|
-
|
76
|
-
reportRunnerResults: function(runner) {
|
77
|
-
onTestRunConfigurationComplete();
|
78
|
-
}
|
79
|
-
};
|
80
|
-
jasmineEnv.execute();
|
81
|
-
return true;
|
82
|
-
},
|
83
|
-
|
84
|
-
onTestsFinish: function() {
|
85
|
-
jasmine.currentEnv_ = null;
|
86
|
-
rootDescribes.collectMode();
|
87
|
-
}
|
88
|
-
};
|
89
|
-
jstestdriver.pluginRegistrar.register(jasminePlugin);
|
90
|
-
|
91
|
-
function formatStack(stack) {
|
92
|
-
var lines = (stack||'').split(/\r?\n/);
|
93
|
-
var frames = [];
|
94
|
-
for (var i = 0; i < lines.length; i++) {
|
95
|
-
if (!lines[i].match(/\/jasmine[\.-]/)) {
|
96
|
-
frames.push(lines[i].replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
|
97
|
-
}
|
98
|
-
}
|
99
|
-
return frames.join('\n');
|
100
|
-
}
|
101
|
-
|
102
|
-
function noop() {}
|
103
|
-
function Describes(window) {
|
104
|
-
var describes = {};
|
105
|
-
var beforeEachs = {};
|
106
|
-
var afterEachs = {};
|
107
|
-
// Here we store:
|
108
|
-
// 0: everyone runs
|
109
|
-
// 1: run everything under ddescribe
|
110
|
-
// 2: run only iits (ignore ddescribe)
|
111
|
-
var exclusive = 0;
|
112
|
-
var collectMode = true;
|
113
|
-
intercept('describe', describes);
|
114
|
-
intercept('xdescribe', describes);
|
115
|
-
intercept('beforeEach', beforeEachs);
|
116
|
-
intercept('afterEach', afterEachs);
|
117
|
-
|
118
|
-
function intercept(functionName, collection) {
|
119
|
-
window[functionName] = function(desc, fn) {
|
120
|
-
if (collectMode) {
|
121
|
-
collection[desc] = function() {
|
122
|
-
jasmine.getEnv()[functionName](desc, fn);
|
123
|
-
};
|
124
|
-
} else {
|
125
|
-
jasmine.getEnv()[functionName](desc, fn);
|
126
|
-
}
|
127
|
-
};
|
128
|
-
}
|
129
|
-
window.ddescribe = function(name, fn) {
|
130
|
-
if (exclusive < 1) {
|
131
|
-
exclusive = 1; // run ddescribe only
|
132
|
-
}
|
133
|
-
window.describe(name, function() {
|
134
|
-
var oldIt = window.it;
|
135
|
-
window.it = function(name, fn) {
|
136
|
-
fn.exclusive = 1; // run anything under ddescribe
|
137
|
-
jasmine.getEnv().it(name, fn);
|
138
|
-
};
|
139
|
-
try {
|
140
|
-
fn.call(this);
|
141
|
-
} finally {
|
142
|
-
window.it = oldIt;
|
143
|
-
};
|
144
|
-
});
|
145
|
-
};
|
146
|
-
window.iit = function(name, fn) {
|
147
|
-
exclusive = fn.exclusive = 2; // run only iits
|
148
|
-
jasmine.getEnv().it(name, fn);
|
149
|
-
};
|
150
|
-
|
151
|
-
|
152
|
-
this.collectMode = function() {
|
153
|
-
collectMode = true;
|
154
|
-
exclusive = 0; // run everything
|
155
|
-
};
|
156
|
-
this.playback = function() {
|
157
|
-
collectMode = false;
|
158
|
-
playback(beforeEachs);
|
159
|
-
playback(afterEachs);
|
160
|
-
playback(describes);
|
161
|
-
|
162
|
-
function playback(set) {
|
163
|
-
for ( var name in set) {
|
164
|
-
set[name]();
|
165
|
-
}
|
166
|
-
}
|
167
|
-
};
|
168
|
-
|
169
|
-
this.isExclusive = function(spec) {
|
170
|
-
if (exclusive) {
|
171
|
-
var blocks = spec.queue.blocks;
|
172
|
-
for ( var i = 0; i < blocks.length; i++) {
|
173
|
-
if (blocks[i].func.exclusive >= exclusive) {
|
174
|
-
return true;
|
175
|
-
}
|
176
|
-
}
|
177
|
-
return false;
|
178
|
-
}
|
179
|
-
return true;
|
180
|
-
};
|
181
|
-
}
|
182
|
-
|
183
|
-
})(window);
|
184
|
-
|
185
|
-
// Patch Jasmine for proper stack traces
|
186
|
-
jasmine.Spec.prototype.fail = function (e) {
|
187
|
-
var expectationResult = new jasmine.ExpectationResult({
|
188
|
-
passed: false,
|
189
|
-
message: e ? jasmine.util.formatException(e) : 'Exception'
|
190
|
-
});
|
191
|
-
// PATCH
|
192
|
-
if (e) {
|
193
|
-
expectationResult.trace = e;
|
194
|
-
}
|
195
|
-
this.results_.addResult(expectationResult);
|
196
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
f6b1cf6cac90932c72c4349df8847e0ffd9acbc3 @ 2012-04-29
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008-2011 Pivotal Labs
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/test/lib/jasmine/index.js
DELETED
@@ -1,180 +0,0 @@
|
|
1
|
-
var fs = require('fs');
|
2
|
-
var sys = require('sys');
|
3
|
-
var path = require('path');
|
4
|
-
|
5
|
-
var filename = __dirname + '/jasmine.js';
|
6
|
-
global.window = {
|
7
|
-
setTimeout: setTimeout,
|
8
|
-
clearTimeout: clearTimeout,
|
9
|
-
setInterval: setInterval,
|
10
|
-
clearInterval: clearInterval
|
11
|
-
};
|
12
|
-
var src = fs.readFileSync(filename);
|
13
|
-
var jasmine = process.compile(src + '\njasmine;', filename);
|
14
|
-
delete global.window;
|
15
|
-
|
16
|
-
function noop(){}
|
17
|
-
|
18
|
-
jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors, matcher){
|
19
|
-
var log = [];
|
20
|
-
var columnCounter = 0;
|
21
|
-
var start = 0;
|
22
|
-
var elapsed = 0;
|
23
|
-
var verbose = isVerbose || false;
|
24
|
-
var fileMatcher = new RegExp(matcher || "\.js$");
|
25
|
-
var colors = showColors || false;
|
26
|
-
var specs = jasmine.getAllSpecFiles(folder, fileMatcher);
|
27
|
-
|
28
|
-
var ansi = {
|
29
|
-
green: '\033[32m',
|
30
|
-
red: '\033[31m',
|
31
|
-
yellow: '\033[33m',
|
32
|
-
none: '\033[0m'
|
33
|
-
};
|
34
|
-
|
35
|
-
for (var i = 0, len = specs.length; i < len; ++i){
|
36
|
-
var filename = specs[i];
|
37
|
-
require(filename.replace(/\.*$/, ""));
|
38
|
-
}
|
39
|
-
|
40
|
-
var jasmineEnv = jasmine.getEnv();
|
41
|
-
jasmineEnv.reporter = {
|
42
|
-
log: function(str){
|
43
|
-
},
|
44
|
-
|
45
|
-
reportSpecStarting: function(runner) {
|
46
|
-
},
|
47
|
-
|
48
|
-
reportRunnerStarting: function(runner) {
|
49
|
-
sys.puts('Started');
|
50
|
-
start = Number(new Date);
|
51
|
-
},
|
52
|
-
|
53
|
-
reportSuiteResults: function(suite) {
|
54
|
-
var specResults = suite.results();
|
55
|
-
var path = [];
|
56
|
-
while(suite) {
|
57
|
-
path.unshift(suite.description);
|
58
|
-
suite = suite.parentSuite;
|
59
|
-
}
|
60
|
-
var description = path.join(' ');
|
61
|
-
|
62
|
-
if (verbose)
|
63
|
-
log.push('Spec ' + description);
|
64
|
-
|
65
|
-
specResults.items_.forEach(function(spec){
|
66
|
-
if (spec.failedCount > 0 && spec.description) {
|
67
|
-
if (!verbose)
|
68
|
-
log.push(description);
|
69
|
-
log.push(' it ' + spec.description);
|
70
|
-
spec.items_.forEach(function(result){
|
71
|
-
log.push(' ' + result.trace.stack + '\n');
|
72
|
-
});
|
73
|
-
}
|
74
|
-
});
|
75
|
-
},
|
76
|
-
|
77
|
-
reportSpecResults: function(spec) {
|
78
|
-
var result = spec.results();
|
79
|
-
var msg = '';
|
80
|
-
if (result.passed())
|
81
|
-
{
|
82
|
-
msg = (colors) ? (ansi.green + '.' + ansi.none) : '.';
|
83
|
-
// } else if (result.skipped) { TODO: Research why "result.skipped" returns false when "xit" is called on a spec?
|
84
|
-
// msg = (colors) ? (ansi.yellow + '*' + ansi.none) : '*';
|
85
|
-
} else {
|
86
|
-
msg = (colors) ? (ansi.red + 'F' + ansi.none) : 'F';
|
87
|
-
}
|
88
|
-
sys.print(msg);
|
89
|
-
if (columnCounter++ < 50) return;
|
90
|
-
columnCounter = 0;
|
91
|
-
sys.print('\n');
|
92
|
-
},
|
93
|
-
|
94
|
-
|
95
|
-
reportRunnerResults: function(runner) {
|
96
|
-
elapsed = (Number(new Date) - start) / 1000;
|
97
|
-
sys.puts('\n');
|
98
|
-
log.forEach(function(log){
|
99
|
-
sys.puts(log);
|
100
|
-
});
|
101
|
-
sys.puts('Finished in ' + elapsed + ' seconds');
|
102
|
-
|
103
|
-
var summary = jasmine.printRunnerResults(runner);
|
104
|
-
if(colors)
|
105
|
-
{
|
106
|
-
if(runner.results().failedCount === 0 )
|
107
|
-
sys.puts(ansi.green + summary + ansi.none);
|
108
|
-
else
|
109
|
-
sys.puts(ansi.red + summary + ansi.none);
|
110
|
-
} else {
|
111
|
-
sys.puts(summary);
|
112
|
-
}
|
113
|
-
(done||noop)(runner, log);
|
114
|
-
}
|
115
|
-
};
|
116
|
-
jasmineEnv.execute();
|
117
|
-
};
|
118
|
-
|
119
|
-
jasmine.getAllSpecFiles = function(dir, matcher){
|
120
|
-
var specs = [];
|
121
|
-
|
122
|
-
if (fs.statSync(dir).isFile() && dir.match(matcher)) {
|
123
|
-
specs.push(dir);
|
124
|
-
} else {
|
125
|
-
var files = fs.readdirSync(dir);
|
126
|
-
for (var i = 0, len = files.length; i < len; ++i){
|
127
|
-
var filename = dir + '/' + files[i];
|
128
|
-
if (fs.statSync(filename).isFile() && filename.match(matcher)){
|
129
|
-
specs.push(filename);
|
130
|
-
}else if (fs.statSync(filename).isDirectory()){
|
131
|
-
var subfiles = this.getAllSpecFiles(filename, matcher);
|
132
|
-
subfiles.forEach(function(result){
|
133
|
-
specs.push(result);
|
134
|
-
});
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
return specs;
|
140
|
-
};
|
141
|
-
|
142
|
-
jasmine.printRunnerResults = function(runner){
|
143
|
-
var results = runner.results();
|
144
|
-
var suites = runner.suites();
|
145
|
-
var msg = '';
|
146
|
-
msg += suites.length + ' test' + ((suites.length === 1) ? '' : 's') + ', ';
|
147
|
-
msg += results.totalCount + ' assertion' + ((results.totalCount === 1) ? '' : 's') + ', ';
|
148
|
-
msg += results.failedCount + ' failure' + ((results.failedCount === 1) ? '' : 's') + '\n';
|
149
|
-
return msg;
|
150
|
-
};
|
151
|
-
|
152
|
-
function now(){
|
153
|
-
return new Date().getTime();
|
154
|
-
}
|
155
|
-
|
156
|
-
jasmine.asyncSpecWait = function(){
|
157
|
-
var wait = jasmine.asyncSpecWait;
|
158
|
-
wait.start = now();
|
159
|
-
wait.done = false;
|
160
|
-
(function innerWait(){
|
161
|
-
waits(10);
|
162
|
-
runs(function() {
|
163
|
-
if (wait.start + wait.timeout < now()) {
|
164
|
-
expect('timeout waiting for spec').toBeNull();
|
165
|
-
} else if (wait.done) {
|
166
|
-
wait.done = false;
|
167
|
-
} else {
|
168
|
-
innerWait();
|
169
|
-
}
|
170
|
-
});
|
171
|
-
})();
|
172
|
-
};
|
173
|
-
jasmine.asyncSpecWait.timeout = 4 * 1000;
|
174
|
-
jasmine.asyncSpecDone = function(){
|
175
|
-
jasmine.asyncSpecWait.done = true;
|
176
|
-
};
|
177
|
-
|
178
|
-
for ( var key in jasmine) {
|
179
|
-
exports[key] = jasmine[key];
|
180
|
-
}
|