Skip to content

Commit ff62c27

Browse files
committed
Merge pull request #78 from browserstack/jasmine2.0
Jasmine2.0
2 parents 92fb720 + 2c960d8 commit ff62c27

File tree

7 files changed

+54
-3
lines changed

7 files changed

+54
-3
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
[submodule "tests/external-repos/mout"]
1111
path = tests/external-repos/mout
1212
url = https://github.com/browserstack/mout
13+
[submodule "tests/external-repos/Comparatorsjs"]
14+
path = tests/external-repos/Comparatorsjs
15+
url = https://github.com/browserstack/Comparators.js

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
A command line interface to run browser tests over BrowserStack.
22

33
## Install
4-
Go to the `browserstack-runner` directory.
4+
Go to the `browserstack-runner` directory.
55
Install browserstack-runner
66

77
npm -g install
@@ -36,7 +36,7 @@ If nothing is provided as `preset` **default** is used.
3636
in a browser.
3737

3838
- *test_framework*: Specify test framework which will execute the tests.
39-
We support qunit, jasmine and mocha.
39+
We support qunit, jasmine, jasmine 2.0 and mocha.
4040

4141
- *timeout*: Specify worker timeout with BrowserStack.
4242

@@ -48,7 +48,7 @@ A sample configuration file:
4848
{
4949
"username": "<username>",
5050
"key": "<key>",
51-
"test_framework": "qunit/jasmine/mocha",
51+
"test_framework": "qunit/jasmine/jasmine2/mocha",
5252
"test_path": ["relative/path/to/test/page1", "relative/path/to/test/page2"],
5353
"browsers": [{
5454
"browser": "firefox",

lib/_patch/jasmine2-plugin.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(function() {
2+
var checker = setInterval(function() {
3+
if (!jasmine.running) {
4+
var results = {};
5+
var specs = jsApiReporter.specs();
6+
results.runtime = jsApiReporter.executionTime();
7+
results.total = 0;
8+
results.passed = 0;
9+
results.failed = 0;
10+
results.tracebacks = [];
11+
12+
for (var spec in specs) {
13+
if (specs[spec].status === 'passed') {
14+
results.passed++;
15+
} else {
16+
results.tracebacks.push(specs[spec].description);
17+
results.failed = true;
18+
}
19+
}
20+
21+
results.total = results.passed + results.failed;
22+
results.url = window.location.pathname;
23+
BrowserStack.post('/_report', results, function(){});
24+
}
25+
clearInterval(checker);
26+
}, 1000);
27+
})();
28+

lib/server.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ exports.Server = function Server(bsClient, workers) {
7979
framework_scripts = {
8080
'qunit': ['qunit-plugin.js'],
8181
'jasmine': ['jasmine-jsreporter.js', 'jasmine-plugin.js'],
82+
'jasmine2': ['jasmine2-plugin.js'],
8283
'mocha': ['mocha-plugin.js']
8384
};
8485

@@ -103,6 +104,10 @@ exports.Server = function Server(bsClient, workers) {
103104
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n";
104105
});
105106
patch += "<script type='text/javascript'>jasmine.getEnv().addReporter(new jasmine.JSReporter());</script>\n";
107+
} else if (config['test_framework'] && config['test_framework'] == "jasmine2") {
108+
framework_scripts['jasmine2'].forEach(function(script) {
109+
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n";
110+
});
106111
} else if (config['test_framework'] && config['test_framework'] == "mocha") {
107112
framework_scripts['mocha'].forEach(function(script) {
108113
patch += "<script type='text/javascript' src='/_patch/" + script + "'></script>\n";

tests/conf/Comparatorsjs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"username": "BROWSERSTACK_USERNAME",
3+
"key": "BROWSERSTACK_KEY",
4+
"test_path": "comparators.spec-runner.html",
5+
"test_framework": "jasmine2",
6+
"debug": true,
7+
"browsers": [
8+
]
9+
}

tests/external-repos/Comparatorsjs

Submodule Comparatorsjs added at 45e3798

tests/test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,16 @@ def jasmine
6464
run_project("mout", "jasmine", ["978 of 978 passed"], "tests/runner.html")
6565
end
6666

67+
def jasmine2
68+
run_project("Comparatorsjs", "jasmine2", ["6 of 6 passed"], "comparators.spec-runner.html")
69+
end
70+
6771
def run
6872
execute("cd #{RUNNER_DIR} && git submodule init && git submodule update")
6973
qunit
7074
mocha
7175
jasmine
76+
jasmine2
7277
end
7378
end
7479

0 commit comments

Comments
 (0)