chrisl-921fb74d
chrisl-921fb74d

Reputation: 23120

Generating a SpecRunner for jasmine using grunt

When i add and remove tests i often have to create/edit a SpecRunner.html file.

I know i can run a test server using karma. But for developing tests i prefer to inspect the results in the browser. I've tried using karma and i currently run tests with grunt; but sometimes i prefer the console better for writing tests.

Are there yeoman generators that will generate a specrunner for me automatically at this point in time?

I've found this npm package: https://npmjs.org/package/atropa-jasmine-spec-runner-generator-html

but it doesn't seem widely supported or runs via grunt.

Upvotes: 0

Views: 806

Answers (1)

FlavorScape
FlavorScape

Reputation: 14299

grunt-template-jasmine-requirejs is a good option for Angular/Backbone projects. It is meant to work with grunt-contrib-jasmine, but it will generate a spec runner html file for you on the fly using grunt.

Specify the output in the gruntfile

jasmine:{
   template: require('grunt-template-jasmine-requirejs'),
   templateOptions: {
       requireConfigFile: 'src/test/js/require-unit-config.js'
   },
   test:{
       options:{
         outfile:'mySpecRunner.html'
       }
   }
}

Upvotes: 1

Related Questions