Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Karma - JS Test Runner

Karma - JS Test Runner

Talk given at MelbJS - August 2013

Sebastiano Armeli

August 14, 2013
Tweet

More Decks by Sebastiano Armeli

Other Decks in Programming

Transcript

  1. Domain Specific Language (DSL) for defining tests npm install -g

    karma karma init karma start // Karma starts listening
  2. Domain Specific Language (DSL) for defining tests npm install -g

    karma karma init karma start karma run // Karma runs the tests
  3. module.exports = function(config) { config.set({ basePath: './../..', frameworks: ['jasmine', ‘requirejs’],

    files: [ ‘spec/javascripts/test-main.js’, {pattern: 'spec/javascripts/fixtures/**/*.html', watched: false}, {pattern: 'app/assets/javascripts/**/*.js'}, {pattern: 'spec/javascripts/**/*.js'} ], port: 9876, //default browsers: ['Chrome’, ‘ChromeCanary’], singleRun: false, autoWatch: true }); }
  4. karma-junit-reporter karma-coverage reporters: [‘junit’], junitReporter : { outputFile: 'test-reports.xml', suite:

    'My Suite' } reporters: [‘coverage’], coverageReporter: { type : 'html', dir : 'coverage/' }