कहो मैं निम्नलिखित कोड है की अनदेखी करने के Istanbul.js हो रही है:परिभाषित करते हैं (require.js) परिभाषा
define([
'a'
], function(a) {
return {
initialize: function() {
},
stuff: function() {
}
};
});
इस्तांबुल की रिपोर्ट है कि केवल 1/3 कार्यों परीक्षण किया गया है। जो कुछ हद तक सच है क्योंकि मैंने केवल main.initialize
के खिलाफ परीक्षण चलाया है।
मैं इस्तांबुल को कॉलबैक को परिभाषित करने के लिए उपयोग किए गए फ़ंक्शन को अनदेखा कैसे कर सकता हूं?
संपादित करें: अतिरिक्त Gruntfile.js
config
jasmine: {
coverage: {
src: 'src/assets/js/app/**/*.js',
options: {
specs: 'src/assets/js/spec/**/*Spec.js',
host: 'http://127.0.0.1:8000/',
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
//files: 'src/assets/js/app/**/*.js',
coverage: 'bin/coverage/coverage.json',
report: [
{type: 'html', options: {dir: 'src/coverage/html'}},
{type: 'text-summary'}
],
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
baseUrl: 'src/assets/js',
paths: {
/* 'jquery': 'lib/jquery',
'underscore': 'lib/lodash',
'text': 'lib/text',
'i18n': 'lib/i18n',*/
}
}
}
},
keepRunner: true
}
}
}
संपादित करें: उदाहरण युक्ति
define([
'app/main'
], function(main) {
describe('app/main', function() {
it('initailize should not error', function() {
expect(main.initialize()).toBe(undefined);
});
});
});
मैं इसे बाहर का परीक्षण करने में असमर्थ था (के रूप में मैं बजाय कर्म का उपयोग, जो इस मुद्दे को नहीं था पर चले गए)। लेकिन आपने जवाब दिया, और किसी और ने आपके जवाब को झुकाव से मुझे विश्वास दिलाया कि आप बक्षीस के योग्य हैं। आनंद लें, और धन्यवाद। – jshthornton