-
Notifications
You must be signed in to change notification settings - Fork 157
Add support for Jasmine #167
Comments
You could add this code to testFrameworks in inject.js : "Jasmine": {
detect: function() {
return typeof jasmine !== "undefined" && typeof describe !== "undefined" && typeof it !== "undefined";
},
install: function() {
log('installing Jasmine framework support');
var jasmineTestSwarmResults = null;
var testSwarmReporter = {
reportRunnerStarting: function (runner)
{
log('Jasmine reportRunnerStarting');
// reset counters
jasmineTestSwarmResults = {
fail: 0,
error: 0,
total: 0
};
},
reportRunnerResults: function (runner)
{
// testing finished
log('Jasmine reportRunnerResults');
submit(jasmineTestSwarmResults);
},
reportSuiteResults: function (suite)
{
log('Jasmine reportSuiteResults:' + suite.description);
// not in use
},
reportSpecStarting: function (spec)
{
log('Jasmine reportSpecStarting' + spec.description);
jasmineTestSwarmResults.total++;
window.TestSwarm.heartbeat(); // we are still alive, trigger heartbeat so test execution won't time out
},
reportSpecResults: function (spec)
{
log('Jasmine reportSpecResults: ' + spec.description);
if(spec.results().failedCount>0)
jasmineTestSwarmResults.fail++;
},
log: function (str)
{
log('Jasmine says: ' + str);
}
};
window.TestSwarm.serialize = function () {
// take only the #wrapper and #html as a test result
remove('content');
return trimSerialize();
};
var jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(testSwarmReporter);
log('Jasmine injected!');
}
}, |
Any updates on this? I would really like to try this with our jasmine test suite. |
I haven't had a chance to try it (other priorities). @seanzx85, perhaps you can give the patch a try in your TestSwarm install and let us know how it works out? |
I will see what I can do. Might take a day or two. |
I tried it and in Chrome 25 jasmine runs tests in iframe as intended, but no results are being processed afterwards (job run just stays in pending state indefinitely). EDIT: Okay, sorry, guys, it was my fault, after re-checking I noticed that inject script was loading before the Jasmine. Now it runs OK. Only (minor, maybe) problem is displaying results for successful/errored job run. TrivialReporter tries to run again in the iframe showing the results and hangs. |
This is now working per d8114f8.
|
At this point, the two JS testing frameworks that seem to get the most attention are QUnit and Jasmine. TestSwarm shouldn't really care about which one you use, so adding support for Jasmine seems like a good idea. Might be enough to just add a check and hooks for it in the main integration script.
Even if not a priority for the jQuery project, maybe someone already implemented it - we're certainly interested in adding support.
The text was updated successfully, but these errors were encountered: