-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for jasmine 2 #109
Comments
I've tried to get the ball rolling with jasmine-jsreporter and jasmine itself - it seems a bunch of information that used to be exposed to reporters in jasmine 1.3.1 is now no-longer available. |
the Sauce api gets the JSON data from the old jsreporter and does a lot of parsing on that specific structure to get the data to populate the various fields Sauce uses. The original idea was that everyone already using Jasmine could easily expose their results and Sauce parses it to get what they need. But there's no consistent method for getting the results in Jasmine 2.0 yet. My preference would be to use the Are there more fields you'd like supported on the |
Ideally if @sclevine's reporter works, have that added to sauce's framework support for when jasmine version is set to 2.0.0. I'll give |
What's the status on this? |
@rkh - I've made JSReporter with Jasmine 2.0, and have written a JSReporter2 class as part of that project. Still waiting on Jasmine#575 - the Pivotal guys seem to be MIA for over a month now |
For what it's worth, I solved this by using karma. |
Update: pivotal have merged in the required reporting changes in jasmine 2.0.1 (jasmine/jasmine#575), and jasmine-jsreporter has been updated to match (detro/jasmine-jsreporter#17). There should no-longer be anything blocking grunt-saucelabs from adopting Jasmine 2.0.1. Jasmine 2.0.1 and jasmine-jsreporter need to be versioned up in grunt-saucelabs examples folder: https://github.com/axemclion/grunt-saucelabs/tree/b25ff61b7ce0126bbe507f931758ce8cfb64bae7/examples/jasmine/lib Looks like @stdavis has opened gruntjs/grunt-contrib-jasmine#154 to progress this in grunt-contrib-jasmine |
just got back from vacation, I'll see about adding this in. |
👍 we would love to start getting saucy and I believe this is what we are waiting on. |
thanks for pinging me @steveoh |
any updates @Jonahss? |
Currently working on Appium, maybe if I get my tasks done quick enough I can sneak this in. |
@Jonahss if you tell me what needs to happen I can try to do it. |
Right now, if you run a unit test and pass in the If you run a nut test and pass in the To add support for a new format, it requires that a Sauce employee add the capability to properly parse the results to the Sauce servers. So your other option is to parse the jasmine2.1 results yourself and get them into either the Thanks for continuing to keep this issue active. |
So if you use jasmine-jsreporter and add JSReporter2 as follows: jasmine.getEnv().addReporter(new jasmine.JSReporter2()) Results should automatically be populated in the old JasmineReporter format. (Provided the jasmine 2 reporters haven't changed between 2.0.1 and 2.1) |
So whats happening with this? Is this supported as long as I use the right reporter? |
@lukeapage if you follow the instructions given by @alextreppass above, you should be able to use jasmine2.0 |
Thanks, I have done that, was just confused originally as to why this was open if its not an issue. So far, no luck https://travis-ci.org/less/less.js/jobs/38538939 https://github.com/less/less.js/pull/2236/files It looks to me like status is blank? But everything else is there? Any suggestions? |
@lukeapage you might be running into the issue where Sauce can't handle super long test results. Try with a smaller test suite. |
I read it was 64kb and didn't think we had reached that, but I tried a smaller suite and it worked - thanks. Any idea if that limit will be lifted? Has anyone raised it with sauce? |
Thanks! Sauce is aware of the limit issue, and it's slated to be fixed. Don't know On Mon, Oct 20, 2014 at 11:56 PM, Luke Page [email protected]
|
Thanks for the helpful tips @Jonahss. I too ran into the larger test suite. I only have 185 specs which doesn't seem that much to me but running a subset of 14 made everything work. Do you have a link to the bug at sauce that we can track. This is a show stopper for me until I can run my entire test suite. |
@stdavis it shouldn't be a show stopper. You can just alter your reporting script to only add the info for a failure, and not even bother reporting passes. |
@Jonahss What do you mean by "reporting script"? You mean alter |
Ah yes, altering the jasmine reporter OR just override the call to the reporter and sanitize the results. Sauce Labs runs the following Javascript code to get the results from your page: So if you override that method with your own, and call the original method to get and parse the results, you're done.
Also check out using the |
@Jonahss Thanks for the tip. I will implement the work around that you suggest. Really appreciate your help. |
I've tried to implement your pseudo code and got it working. This is dependent on jquery
|
@alexan Thanks, You save my time. |
because saucelabs barfs on output > 64k adapted from axemclion/grunt-saucelabs#109 (comment)
FWIW, ES5-only no-jquery version of @alexan's solution for trimming the passing tests: jasmine.getEnv().addReporter(new jasmine.JSReporter2());
(function () {
var oldJSReport = window.jasmine.getJSReport;
window.jasmine.getJSReport = function () {
var results = oldJSReport();
if (results) {
return {
durationSec: results.durationSec,
suites: removePassingTests(results.suites),
passed: results.passed
};
} else {
return null;
}
};
function removePassingTests (suites) {
return suites.filter(specFailed)
.map(mapSuite);
}
function mapSuite (suite) {
var result = {};
for (var s in suite) {
result[s] = suite[s];
}
result.specs = suite.specs.filter(specFailed);
result.suites = removePassingTests(suite.suites);
return result;
}
function specFailed (item) {
return !item.passed;
}
})(); |
jasmine-jsreporter doesn't seem to support jasmine 2.0.0 yet, but @sclevine submitted a PR which seems to have done most of the heavy lifting - see detro/jasmine-jsreporter#7
I can get sauce running the tests by including the modified jasmine-jsreporter inside our Gruntfile's grunt-contrib-jasmine vendor section, which overwrites the JSReporter from grunt-saucelabs, and namespaces
window.jasmine.getJSReport()
.The screencast then says "625 specs, 0 failures, 9 pending specs" and is green/passing, and the selenium log says all suites and specs are passing, however sauce (or grunt-saucelabs?) is saying the tests haven't passed. Going to the JSUnitTest tab on the sauce job however tells me
Jasmine run on Sauce failed: 0 total: 0 passed: 0
,finished in s
, andPassing 0 tests
.Is Jasmine 2 support on the grunt-saucelabs roadmap? If so what are the blockers currently?
The text was updated successfully, but these errors were encountered: