grunt-contrib-jasmine icon indicating copy to clipboard operation
grunt-contrib-jasmine copied to clipboard

Configure the jasmine's random on gruntfile

Open doug-source opened this issue 6 years ago • 2 comments
trafficstars

How can I configure the random option using grunt-contrib-jasmine? I can do it directly with jasmine's command line, but running jasmine's task by grunt-cli I didn't find the random option. Then the output of command line always shows the specs' randomic output.

doug-source avatar Jan 15 '19 03:01 doug-source

There are a lot of jasmine options that are not mentioned at all in the grunt-contrib-jasmine configuration docs. e.g.:

  • random
  • hideDisabled
  • seed

Is is possible to set these options? How?

mojoaxel avatar May 02 '19 18:05 mojoaxel

This is do-able right now (I think) but the way to do it is non-obvious:

  1. Use a custom boot.js. This can be accomplished by setting customBootFile to a path that contains a non-standard boot file. This option is unfortunately not documented.
  2. Change the standard boot file (see link above), by adding a step to "configure" the environment.

Find this line from the example linked above

var env = jasmine.getEnv();

and add after it

env.configure({
    // Whatever needs to be configured here
})

If you are already using a custom template, something similar can be done in its reporter.js through jasmine.getEnv(). There is also the potential of creating a mixin to inject this code to the child template.

jabbany avatar May 29 '19 08:05 jabbany