Giter VIP home page Giter VIP logo

Comments (29)

alextreppass avatar alextreppass commented on May 26, 2024

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.

detro/jasmine-jsreporter#7

jasmine/jasmine#547

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

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 custom framework, explained in the docs. Writing a small script to parse the results into that format would get you most of the data you need, correct? Other people can use the same, or a modified version of the script.

Are there more fields you'd like supported on the custom framework? Or would you prefer to have @sclevine's specific reporter added to sauce's framework support?

from grunt-saucelabs.

alextreppass avatar alextreppass commented on May 26, 2024

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 custom a play in the coming weeks, see how far I get.

from grunt-saucelabs.

rkh avatar rkh commented on May 26, 2024

What's the status on this?

from grunt-saucelabs.

alextreppass avatar alextreppass commented on May 26, 2024

@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

from grunt-saucelabs.

rkh avatar rkh commented on May 26, 2024

For what it's worth, I solved this by using karma.

from grunt-saucelabs.

alextreppass avatar alextreppass commented on May 26, 2024

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

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

just got back from vacation, I'll see about adding this in.

from grunt-saucelabs.

steveoh avatar steveoh commented on May 26, 2024

👍 we would love to start getting saucy and I believe this is what we are waiting on.

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

thanks for pinging me @steveoh
I'll up the priority.

from grunt-saucelabs.

steveoh avatar steveoh commented on May 26, 2024

any updates @Jonahss?

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

Currently working on Appium, maybe if I get my tasks done quick enough I can sneak this in.

from grunt-saucelabs.

steveoh avatar steveoh commented on May 26, 2024

@Jonahss if you tell me what needs to happen I can try to do it.

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

Right now, if you run a unit test and pass in the jasmine framework, Sauce's servers expect to see results in the same format as the test results reporter by the old JasmineReporter.

If you run a nut test and pass in the custom framework, then Sauce's servers are looking for a json object which conforms to the custom framework as outlined in the README.

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.
Unfortunately you can't help with that :( (unless you want a new job)

So your other option is to parse the jasmine2.1 results yourself and get them into either the custom or jasmineReporter formats already supported.

Thanks for continuing to keep this issue active.

from grunt-saucelabs.

alextreppass avatar alextreppass commented on May 26, 2024

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)

from grunt-saucelabs.

lukeapage avatar lukeapage commented on May 26, 2024

So whats happening with this? Is this supported as long as I use the right reporter?

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

@lukeapage if you follow the instructions given by @alextreppass above, you should be able to use jasmine2.0

from grunt-saucelabs.

lukeapage avatar lukeapage commented on May 26, 2024

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://saucelabs.com/jobs/26aa971edb9d4becb74b2c82edc51e86

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?

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

@lukeapage you might be running into the issue where Sauce can't handle super long test results. Try with a smaller test suite.

from grunt-saucelabs.

lukeapage avatar lukeapage commented on May 26, 2024

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?
p.s. great repo, it made things super easy

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

Thanks!
Most the credit due to all the great collaborators.

Sauce is aware of the limit issue, and it's slated to be fixed. Don't know
the deadline though.

On Mon, Oct 20, 2014 at 11:56 PM, Luke Page [email protected]
wrote:

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?
p.s. great repo, it made things super easy


Reply to this email directly or view it on GitHub
#109 (comment)
.

from grunt-saucelabs.

stdavis avatar stdavis commented on May 26, 2024

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.

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

@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.

from grunt-saucelabs.

stdavis avatar stdavis commented on May 26, 2024

@Jonahss What do you mean by "reporting script"? You mean alter jasmine-jsreporter?

from grunt-saucelabs.

Jonahss avatar Jonahss commented on May 26, 2024

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:
window.jasmine.getJSReport()

So if you override that method with your own, and call the original method to get and parse the results, you're done.
PSEUDO CODE:

var oldFunc = window.jasmine.getJSReport;
window.jasmine.getJSReport = function() {
 var results = oldFunc();
 return removePassingTests(results)
}

Also check out using the custom framework, to have even finer control over what gets reported on Sauce.

from grunt-saucelabs.

stdavis avatar stdavis commented on May 26, 2024

@Jonahss Thanks for the tip. I will implement the work around that you suggest. Really appreciate your help.

from grunt-saucelabs.

alexan avatar alexan commented on May 26, 2024

I've tried to implement your pseudo code and got it working. This is dependent on jquery

jasmine.getEnv().addReporter(new jasmine.JSReporter2());

(function () {
   var oldFunc = window.jasmine.getJSReport;
   window.jasmine.getJSReport = function () {
      var results = oldFunc();
      if (results) {
         return {
            durationSec: results.durationSec,
            suites: removePassingTests(results.suites),
            passed: results.passed
         };
      } else {
         return null;
      }
   };

   function removePassingTests(suites) {
      return $.map($.grep(suites, grepFailed), mapSuite);
   }

   function mapSuite(suite) {
      return $.extend({}, suite, {
         specs: $.grep(suite.specs, grepFailed),
         suites: removePassingTests(suite.suites)
      });
   }

   function grepFailed(item) {
      return !item.passed;
   }
})();

from grunt-saucelabs.

leeyeh avatar leeyeh commented on May 26, 2024

@alexan Thanks, You save my time.

from grunt-saucelabs.

gordonwoodhull avatar gordonwoodhull commented on May 26, 2024

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;
    }
})();

from grunt-saucelabs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.