2

If my Jasmine test has failures, it only shows those by default. I have to click "Spec List" to see all of the tests that were run.

Can I somehow get it to always show the spec list by default?

Ian Phillips
  • 2,027
  • 1
  • 19
  • 31

1 Answers1

1

I am using jasmine 2.1.3 with require.js as outlined in this stackoverflow question: Getting requirejs to work with Jasmine and this was bugging me too.

I am also using jquery so I added an event trigger after the .execute() like so:

require(specs, function (spec) {
        jasmineEnv.execute();
        $('.spec-list-menu').click();
      });

I couldn't find any configuration for setting the default, but you can see in the jasmine-html.js file:

    find('.failures-menu').onclick = function() {
      setMenuModeTo('failure-list');
    };
    find('.spec-list-menu').onclick = function() {
      setMenuModeTo('spec-list');
    };

    setMenuModeTo('failure-list');

if you changed it to:

    find('.failures-menu').onclick = function() {
      setMenuModeTo('failure-list');
    };
    find('.spec-list-menu').onclick = function() {
      setMenuModeTo('spec-list');
    };

    setMenuModeTo('spec-list');

It will also set the default.

I don't really like editing libraries like that since I usually forget what I have changed when I update the library.

That was the reason I went with the jquery route.

Community
  • 1
  • 1
vrtis
  • 712
  • 9
  • 9