PDA

View Full Version : What does the ExtJS team use for generating code coverage rep in tandem with Jasmine?



milieu
17 Oct 2013, 1:39 AM
I have some Jasmine specs set up and running for my app. I tried integrating Blanket.js earlier this morning and then realized I needed to manually include with data-cover all of my files, along with incorrect path lookups whenever a require block was hit in ExtJS code. There's got to be a better way of doing this.

What does the ExtJS team use for generating test coverage reports?

mattgoldspink
17 Oct 2013, 4:10 AM
HI,

I can't comment on the Sencha developers, but we used istanbul - there's an example project using Grunt and some custom Sencha jasmine extensions shown here: http://www.mattgoldspink.co.uk/2013/03/26/simplifying-grunt-jasmine-tests-on-an-ext-js-project/

H (http://www.mattgoldspink.co.uk/2013/03/26/simplifying-grunt-jasmine-tests-on-an-ext-js-project/)TH,
Matt

bjornhol
5 Jun 2014, 3:24 AM
Hi,

I looked into different ways (also Blanket.js) and found that Karma was most suitable for us. We have different projects that needed the same setup, so the easiest way to share was to publish a npm module (https://www.npmjs.org/package/karma-extjs). The source files are loaded based on the jsb3 file of each project and the specs don't need a html-file to execute.

Using the karma-extjs module, this is how all our projects do coverage (from the gulp task runner)



var argv = require('yargs').argv;
var karma = require('karma-extjs');

karma.run({
staticPort: 9877,
coverage: true,
jsb3: 'APP/build/app.jsb3',
beforeSource: [
'extjs/ext-all.js',
'test-frameworks/jasmine/jasmine-html.js',
'test-frameworks/sinon/sinon.js',
'APP/test-frameworks/jasmineExtensions.js',
'APP/test-frameworks/sinon_wrapper.js',
'APP/testconfig.js'
],
afterSource: [
'APP/testapp.js'
],
tests: [
'APP/specs/**/*.spec.js'
],
karma: {
browserNoActivityTimeout: 20000,
coverageReporter: {
type: 'html',
dir: argv.o ? argv.o : 'coverage/'
}
}
});