js-test-driver-rails 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/lib/js_test_driver/config.rb +6 -6
- data/vendor/VERSIONS +3 -3
- data/vendor/jasmine-jstd-adapter/jsTestDriverIit.conf +6 -0
- data/vendor/jasmine-jstd-adapter/lib/jstestdriver/JsTestDriver.jar +0 -0
- data/vendor/jasmine-jstd-adapter/src-test/iit/iitSpec.js +46 -0
- data/vendor/jasmine-jstd-adapter/src/JasmineAdapter.js +166 -91
- data/vendor/jasmine-jstd-adapter/test-iit.sh +1 -0
- data/vendor/jasmine-jstd-adapter/test-regular.sh +2 -0
- data/vendor/jasmine-jstd-adapter/test.sh +2 -1
- data/vendor/jasmine/Rakefile +17 -13
- data/vendor/jasmine/jsdoc-template/allclasses.tmpl +17 -0
- data/vendor/jasmine/jsdoc-template/allfiles.tmpl +56 -0
- data/vendor/jasmine/jsdoc-template/class.tmpl +646 -0
- data/vendor/jasmine/jsdoc-template/index.tmpl +39 -0
- data/vendor/jasmine/jsdoc-template/publish.js +184 -0
- data/vendor/jasmine/jsdoc-template/static/default.css +162 -0
- data/vendor/jasmine/jsdoc-template/static/header.html +2 -0
- data/vendor/jasmine/jsdoc-template/static/index.html +19 -0
- data/vendor/jasmine/jsdoc-template/symbol.tmpl +35 -0
- data/vendor/jasmine/lib/jasmine-html.js +12 -6
- data/vendor/jasmine/lib/jasmine.js +2 -2
- data/vendor/jasmine/spec/suites/TrivialReporterSpec.js +3 -0
- data/vendor/jasmine/src/html/TrivialReporter.js +12 -6
- data/vendor/jasmine/src/version.json +1 -1
- data/vendor/js_test_driver.jar +0 -0
- metadata +48 -75
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -22,7 +22,7 @@ module JsTestDriver
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
# Files specified here will not be loaded, it's useful when combined with globbing in includes
|
25
|
+
# Files specified here will not be loaded, it's useful when combined with globbing in includes
|
26
26
|
#
|
27
27
|
# paths should be relative to root_dir
|
28
28
|
def excludes(*paths)
|
@@ -35,7 +35,7 @@ module JsTestDriver
|
|
35
35
|
#
|
36
36
|
# This should be a string with no spaces (if you need to pass parameters to the browser you will
|
37
37
|
# need to create a shell script ans put it's name here)
|
38
|
-
def browser(browsers)
|
38
|
+
def browser(*browsers)
|
39
39
|
browsers.each do |browser|
|
40
40
|
self.browsers << browser
|
41
41
|
end
|
@@ -50,12 +50,12 @@ module JsTestDriver
|
|
50
50
|
# namespace.name["file_name_without the html extension"]
|
51
51
|
#
|
52
52
|
# by default the namespace is called htmlFixtures
|
53
|
-
# and the fixture name is called all
|
53
|
+
# and the fixture name is called all
|
54
54
|
def fixtures(directory, opts = {})
|
55
55
|
fixture = JsTestDriver::HtmlFixture.new(directory, opts[:name], opts[:namespace])
|
56
56
|
if html_fixtures.detect{|f| f.name == fixture.name && f.namespace == fixture.namespace}
|
57
57
|
raise ArgumentError.new("Fixture #{fixture.namespace}.#{fixture.name} already defined!")
|
58
|
-
end
|
58
|
+
end
|
59
59
|
html_fixtures << fixture
|
60
60
|
end
|
61
61
|
|
@@ -186,7 +186,7 @@ module JsTestDriver
|
|
186
186
|
values.each do |attr, value|
|
187
187
|
self.send("#{attr}=", value)
|
188
188
|
end
|
189
|
-
end
|
189
|
+
end
|
190
190
|
|
191
191
|
end
|
192
|
-
end
|
192
|
+
end
|
data/vendor/VERSIONS
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
JsTestDriver: 1.
|
2
|
-
Jasmine: 0.
|
3
|
-
JasmineAdapter: http://github.com/mhevery/jasmine-jstd-adapter/commit/
|
1
|
+
JsTestDriver: 1.3.2
|
2
|
+
Jasmine: 1.0.1
|
3
|
+
JasmineAdapter: http://github.com/mhevery/jasmine-jstd-adapter/commit/66fd298eac4364a02f80cc7d0714adcdffbe175e
|
Binary file
|
@@ -0,0 +1,46 @@
|
|
1
|
+
(function() {
|
2
|
+
var specs = [];
|
3
|
+
|
4
|
+
|
5
|
+
describe('root describe', function() {
|
6
|
+
it('nested it', function() {
|
7
|
+
specs.push('nested it');
|
8
|
+
});
|
9
|
+
});
|
10
|
+
|
11
|
+
|
12
|
+
describe('root describe with iit', function() {
|
13
|
+
it('it as iit sibling', function() {
|
14
|
+
specs.push('it as iit sibling');
|
15
|
+
});
|
16
|
+
|
17
|
+
iit('nested iit', function() {
|
18
|
+
specs.push('nested iit');
|
19
|
+
});
|
20
|
+
});
|
21
|
+
|
22
|
+
|
23
|
+
describe('describe that follows iit with a nested it', function() {
|
24
|
+
it('nested it after iit', function() {
|
25
|
+
specs.push('nested it after iit');
|
26
|
+
});
|
27
|
+
});
|
28
|
+
|
29
|
+
|
30
|
+
describe('describe with iit followed by it', function() {
|
31
|
+
iit('iit that preceeds an it', function() {
|
32
|
+
specs.push('iit that preceeds an it');
|
33
|
+
});
|
34
|
+
|
35
|
+
it('it that follows an iit', function() {
|
36
|
+
specs.push('it that follows an iit');
|
37
|
+
});
|
38
|
+
});
|
39
|
+
|
40
|
+
|
41
|
+
describe('test summary', function() {
|
42
|
+
iit('should have executed all iit tests and nothing else', function() {
|
43
|
+
expect(specs).toEqual(['nested iit', 'iit that preceeds an it']);
|
44
|
+
});
|
45
|
+
});
|
46
|
+
})();
|
@@ -1,111 +1,186 @@
|
|
1
1
|
/**
|
2
2
|
* @fileoverview Jasmine JsTestDriver Adapter.
|
3
|
-
* @author ibolmo@gmail.com (Olmo Maldonado)
|
4
3
|
* @author misko@hevery.com (Misko Hevery)
|
5
4
|
*/
|
6
|
-
|
7
|
-
(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
5
|
+
(function(window) {
|
6
|
+
var rootDescribes = new Describes(window);
|
7
|
+
var describePath = [];
|
8
|
+
rootDescribes.collectMode();
|
9
|
+
|
10
|
+
var jasmineTest = TestCase('Jasmine Adapter Tests', null, 'jasmine test case');
|
11
|
+
|
12
|
+
var jasminePlugin = {
|
13
|
+
name:'jasmine',
|
14
|
+
runTestConfiguration: function(testRunConfiguration, onTestDone, onTestRunConfigurationComplete){
|
15
|
+
if (testRunConfiguration.testCaseInfo_.template_ !== jasmineTest) return;
|
16
|
+
|
17
|
+
var jasmineEnv = jasmine.currentEnv_ = new jasmine.Env();
|
18
|
+
rootDescribes.playback();
|
19
|
+
var specLog = jstestdriver.console.log_ = [];
|
20
|
+
var start;
|
21
|
+
jasmineEnv.specFilter = function(spec) {
|
22
|
+
return rootDescribes.isExclusive(spec);
|
23
|
+
};
|
24
|
+
jasmineEnv.reporter = {
|
25
|
+
log: function(str){
|
26
|
+
specLog.push(str);
|
27
|
+
},
|
28
|
+
|
29
|
+
reportRunnerStarting: function(runner) { },
|
30
|
+
|
31
|
+
reportSpecStarting: function(spec) {
|
32
|
+
specLog = jstestdriver.console.log_ = [];
|
33
|
+
start = new Date().getTime();
|
34
|
+
},
|
35
|
+
|
36
|
+
reportSpecResults: function(spec) {
|
37
|
+
var suite = spec.suite;
|
38
|
+
var results = spec.results();
|
39
|
+
if (results.skipped) return;
|
40
|
+
var end = new Date().getTime();
|
41
|
+
var messages = [];
|
42
|
+
var resultItems = results.getItems();
|
43
|
+
var state = 'passed';
|
44
|
+
for ( var i = 0; i < resultItems.length; i++) {
|
45
|
+
if (!resultItems[i].passed()) {
|
46
|
+
state = resultItems[i].message.match(/AssertionError:/) ? 'error' : 'failed';
|
47
|
+
messages.push({
|
48
|
+
message: resultItems[i].toString(),
|
49
|
+
name: resultItems[i].trace.name,
|
50
|
+
stack: formatStack(resultItems[i].trace.stack)
|
51
|
+
});
|
52
|
+
}
|
53
|
+
}
|
54
|
+
onTestDone(
|
55
|
+
new jstestdriver.TestResult(
|
56
|
+
suite.getFullName(),
|
57
|
+
spec.description,
|
58
|
+
state,
|
59
|
+
jstestdriver.angular.toJson(messages),
|
60
|
+
specLog.join('\n'),
|
61
|
+
end - start));
|
62
|
+
},
|
63
|
+
|
64
|
+
reportSuiteResults: function(suite) {},
|
65
|
+
|
66
|
+
reportRunnerResults: function(runner) {
|
67
|
+
onTestRunConfigurationComplete();
|
68
|
+
}
|
69
|
+
};
|
70
|
+
jasmineEnv.execute();
|
71
|
+
return true;
|
31
72
|
},
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
if (parent) parent.runAfter.apply(this);
|
73
|
+
onTestsFinish: function(){
|
74
|
+
jasmine.currentEnv_ = null;
|
75
|
+
rootDescribes.collectMode();
|
37
76
|
}
|
38
|
-
};
|
39
|
-
return frame;
|
40
77
|
};
|
78
|
+
jstestdriver.pluginRegistrar.register(jasminePlugin);
|
79
|
+
|
80
|
+
function formatStack(stack) {
|
81
|
+
var lines = (stack||'').split(/\r?\n/);
|
82
|
+
var frames = [];
|
83
|
+
for (i = 0; i < lines.length; i++) {
|
84
|
+
if (!lines[i].match(/\/jasmine[\.-]/)) {
|
85
|
+
frames.push(lines[i].replace(/https?:\/\/\w+(:\d+)?\/test\//, '').replace(/^\s*/, ' '));
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return frames.join('\n');
|
89
|
+
}
|
41
90
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
91
|
+
function noop(){}
|
92
|
+
function Describes(window){
|
93
|
+
var describes = {};
|
94
|
+
var beforeEachs = {};
|
95
|
+
var afterEachs = {};
|
96
|
+
// Here we store:
|
97
|
+
// 0: everyone runs
|
98
|
+
// 1: run everything under ddescribe
|
99
|
+
// 2: run only iits (ignore ddescribe)
|
100
|
+
var exclusive = 0;
|
101
|
+
var collectMode = true;
|
102
|
+
intercept('describe', describes);
|
103
|
+
intercept('xdescribe', describes);
|
104
|
+
intercept('beforeEach', beforeEachs);
|
105
|
+
intercept('afterEach', afterEachs);
|
106
|
+
|
107
|
+
function intercept(functionName, collection){
|
108
|
+
window[functionName] = function(desc, fn){
|
109
|
+
if (collectMode) {
|
110
|
+
collection[desc] = function(){
|
111
|
+
jasmine.getEnv()[functionName](desc, fn);
|
112
|
+
};
|
113
|
+
} else {
|
114
|
+
jasmine.getEnv()[functionName](desc, fn);
|
115
|
+
}
|
116
|
+
};
|
117
|
+
}
|
118
|
+
window.ddescribe = function(name, fn){
|
119
|
+
if (exclusive < 1) {
|
120
|
+
exclusive = 1; // run ddescribe only
|
61
121
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
frame.runBefore.apply(currentSpec);
|
122
|
+
window.describe(name, function(){
|
123
|
+
var oldIt = window.it;
|
124
|
+
window.it = function(name, fn){
|
125
|
+
fn.exclusive = 1; // run anything under ddescribe
|
126
|
+
jasmine.getEnv().it(name, fn);
|
127
|
+
};
|
69
128
|
try {
|
70
|
-
|
129
|
+
fn.call(this);
|
71
130
|
} finally {
|
72
|
-
|
73
|
-
}
|
74
|
-
};
|
75
|
-
return spec;
|
131
|
+
window.it = oldIt;
|
132
|
+
};
|
133
|
+
});
|
76
134
|
};
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
jasmine.Env.prototype.beforeEach = (function(beforeEach){
|
82
|
-
return function(beforeEachFunction) {
|
83
|
-
beforeEach.apply(this, arguments);
|
84
|
-
currentFrame.before.push(beforeEachFunction);
|
135
|
+
window.iit = function(name, fn){
|
136
|
+
exclusive = fn.exclusive = 2; // run only iits
|
137
|
+
jasmine.getEnv().it(name, fn);
|
85
138
|
};
|
86
139
|
|
87
|
-
})(jasmine.Env.prototype.beforeEach);
|
88
|
-
|
89
140
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
currentFrame.after.push(afterEachFunction);
|
141
|
+
this.collectMode = function() {
|
142
|
+
collectMode = true;
|
143
|
+
exclusive = 0; // run everything
|
94
144
|
};
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
145
|
+
this.playback = function(){
|
146
|
+
collectMode = false;
|
147
|
+
playback(beforeEachs);
|
148
|
+
playback(afterEachs);
|
149
|
+
playback(describes);
|
150
|
+
|
151
|
+
function playback(set) {
|
152
|
+
for ( var name in set) {
|
153
|
+
set[name]();
|
154
|
+
}
|
155
|
+
}
|
103
156
|
};
|
104
157
|
|
105
|
-
|
158
|
+
this.isExclusive = function(spec) {
|
159
|
+
if (exclusive) {
|
160
|
+
var blocks = spec.queue.blocks;
|
161
|
+
for ( var i = 0; i < blocks.length; i++) {
|
162
|
+
if (blocks[i].func.exclusive >= exclusive) {
|
163
|
+
return true;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
return false;
|
167
|
+
}
|
168
|
+
return true;
|
169
|
+
};
|
170
|
+
}
|
106
171
|
|
107
|
-
|
108
|
-
|
109
|
-
|
172
|
+
})(window);
|
173
|
+
|
174
|
+
// Patch Jasmine for proper stack traces
|
175
|
+
jasmine.Spec.prototype.fail = function (e) {
|
176
|
+
var expectationResult = new jasmine.ExpectationResult({
|
177
|
+
passed: false,
|
178
|
+
message: e ? jasmine.util.formatException(e) : 'Exception'
|
179
|
+
});
|
180
|
+
// PATCH
|
181
|
+
if (e) {
|
182
|
+
expectationResult.trace = e;
|
183
|
+
}
|
184
|
+
this.results_.addResult(expectationResult);
|
185
|
+
};
|
110
186
|
|
111
|
-
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
java -jar lib/jstestdriver/JsTestDriver.jar --config jsTestDriverIit.conf --tests "all" --reset
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
source test-regular.sh
|
2
|
+
source test-iit.sh
|
data/vendor/jasmine/Rakefile
CHANGED
@@ -91,8 +91,9 @@ jasmine.version_= {
|
|
91
91
|
FileUtils.cp("src/html/jasmine.css", "lib/jasmine.css")
|
92
92
|
end
|
93
93
|
|
94
|
+
downloads_file = 'pages/download.html.md'
|
94
95
|
task :need_pages_submodule do
|
95
|
-
unless File.exists?(
|
96
|
+
unless File.exists?(downloads_file)
|
96
97
|
raise "Jasmine pages submodule isn't present. Run git submodule update --init"
|
97
98
|
end
|
98
99
|
end
|
@@ -109,6 +110,8 @@ jasmine.version_= {
|
|
109
110
|
t[:files] = jasmine_sources << jasmine_html_sources
|
110
111
|
t[:options] = "-a"
|
111
112
|
t[:out] = "pages/jsdoc"
|
113
|
+
# JsdocHelper bug: template must be relative to the JsdocHelper gem, ick
|
114
|
+
t[:template] = File.join("../".*(100), Dir::getwd, "jsdoc-template")
|
112
115
|
end
|
113
116
|
Rake::Task[:lambda_jsdoc].invoke
|
114
117
|
end
|
@@ -131,7 +134,8 @@ jasmine.version_= {
|
|
131
134
|
{
|
132
135
|
"lib/jasmine.js" => "jasmine.js",
|
133
136
|
"lib/jasmine-html.js" => "jasmine-html.js",
|
134
|
-
"src/html/jasmine.css" => "jasmine.css"
|
137
|
+
"src/html/jasmine.css" => "jasmine.css",
|
138
|
+
"MIT.LICENSE" => "MIT.LICENSE"
|
135
139
|
}.each_pair do |src, dest|
|
136
140
|
FileUtils.cp(File.join(root, src), File.join(lib_dir, dest))
|
137
141
|
end
|
@@ -151,26 +155,26 @@ jasmine.version_= {
|
|
151
155
|
require 'digest/sha1'
|
152
156
|
|
153
157
|
download_html = "<!-- START_DOWNLOADS -->\n"
|
154
|
-
download_html += "<table>\n<tr><th></th><th>Version</th><th>Size</th><th>Date</th><th>SHA1</th></tr>\n"
|
155
158
|
Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f|
|
156
159
|
sha1 = Digest::SHA1.hexdigest File.read(f)
|
157
160
|
|
158
161
|
fn = f.sub(/^pages\//, '')
|
159
162
|
version = /jasmine-standalone-(.*).zip/.match(f)[1]
|
160
|
-
|
161
|
-
download_html += "<
|
162
|
-
download_html += "<td class=\"
|
163
|
-
download_html += "<td class=\"
|
164
|
-
download_html += "<td class=\"
|
165
|
-
download_html += "<td class=\"
|
163
|
+
prerelease = /\.rc/.match(f)
|
164
|
+
download_html += prerelease ? "<tr class=\"rc\">\n" : "<tr>\n"
|
165
|
+
download_html += " <td class=\"link\"><a href=\"#{fn}\">#{fn.sub(/downloads\//, '')}</a></td>\n"
|
166
|
+
download_html += " <td class=\"version\">#{version}</td>\n"
|
167
|
+
download_html += " <td class=\"size\">#{File.size(f) / 1024}k</td>\n"
|
168
|
+
download_html += " <td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n"
|
169
|
+
download_html += " <td class=\"sha\">#{sha1}</td>\n"
|
166
170
|
download_html += "</tr>\n"
|
167
171
|
end
|
168
|
-
download_html += "
|
172
|
+
download_html += "<!-- END_DOWNLOADS -->"
|
169
173
|
|
170
|
-
|
174
|
+
downloads_page = File.read(downloads_file)
|
171
175
|
matcher = /<!-- START_DOWNLOADS -->.*<!-- END_DOWNLOADS -->/m
|
172
|
-
|
173
|
-
File.open(
|
176
|
+
downloads_page = downloads_page.sub(matcher, download_html)
|
177
|
+
File.open(downloads_file, 'w') {|f| f.write(downloads_page)}
|
174
178
|
puts "rewrote that file"
|
175
179
|
end
|
176
180
|
end
|