grunt-contrib-jasmine/docs/jasmine-examples.md
2013-01-09 21:24:18 -08:00

1.1 KiB

Basic Use

Sample configuration to run Pivotal Labs' example Jasmine application.

// Example configuration
grunt.initConfig({
  jasmine: {
    pivotal: {
      src: 'src/**/*.js'
      options: {
        specs: 'spec/*Spec.js',
        helpers: 'spec/*Helper.js'
      }
    }
  }
}

Supplying a custom template

Supplying a custom template to the above example

// Example configuration
grunt.initConfig({
  jasmine: {
    customTemplate: {
      src: 'src/**/*.js',
      options: {
        specs: 'spec/*Spec.js',
        helpers: 'spec/*Helper.js'
        template: 'custom.tmpl'
      }
    }
  }
}

Sample RequireJS/NPM Template usage

// Example configuration
grunt.initConfig({
  jasmine: {
    yourTask: {
      src: 'src/**/*.js',
      options: {
        specs: 'spec/*Spec.js',
        template: require('grunt-template-jasmine-requirejs')
      }
    }
  }
}

NPM Templates are just node modules, so you can write and treat them as such.

Please see the grunt-template-jasmine-requirejs documentation for more information on the RequireJS template.