Commit 3507792b by Ehtesham Committed by Usman Khalid

coverage fixes

parent aee139ae
......@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: false},
{pattern: 'xmodule_js/common_static/js/src/utility.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/jquery.min.js', included: false},
......@@ -48,6 +48,7 @@ var files = [
{pattern: 'xmodule_js/common_static/js/vendor/Squire.js', included: false},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-stealth.js', included: false},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-waituntil.js', included: false},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/jasmine-imagediff.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/**/*.js', included: false},
......@@ -76,52 +77,71 @@ var files = [
},
{pattern: 'xmodule_js/common_static/js/vendor/mock-ajax.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/text.js', included: false},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.js', included: false},
{pattern: 'edx-pattern-library/js/modernizr-custom.js', included: false},
{pattern: 'edx-pattern-library/js/afontgarde.js', included: false},
{pattern: 'edx-pattern-library/js/edx-icons.js', included: false},
{pattern: 'edx-pattern-library/js/**/*.js', included: false},
{pattern: 'edx-ui-toolkit/js/**/*.js', included: false}
];
// Paths to source JavaScript files
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true, nocache: true},
{pattern: 'coffee/src/**/*.js', included: false, nocache: true},
{pattern: 'js/**/*.js', included: false, nocache: true},
{pattern: 'js/certificates/**/*.js', included: false, nocache: true},
{pattern: 'js/factories/**/*.js', included: false, nocache: true},
{pattern: 'common/js/**/*.js', included: false, nocache: true},
{pattern: 'edx-pattern-library/js/**/*.js', included: false, nocache: true},
{pattern: 'edx-ui-toolkit/js/**/*.js', included: false, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'coffee/src/**/!(*spec).js', included: false},
{pattern: 'js/**/!(*spec).js', included: false},
{pattern: 'common/js/**/!(*spec).js', included: false}
];
// Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/main.js', included: false, nocache: true},
{pattern: 'coffee/spec/**/*.js', included: false, nocache: true},
{pattern: 'js/spec/**/*.js', included: false, nocache: true},
{pattern: 'js/certificates/spec/**/*.js', included: false, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'coffee/spec/**/*spec.js', included: false},
{pattern: 'js/spec/**/*spec.js', included: false},
{pattern: 'js/certificates/spec/**/*spec.js', included: false}
];
// Paths to fixture files
{pattern: 'coffee/fixtures/**/*.underscore', included: false, nocache: true},
{pattern: 'templates/**/*.underscore', included: false, nocache: true},
{pattern: 'common/templates/**/*.underscore', included: false, nocache: true},
// Paths to fixture files
var fixtureFiles = [
{pattern: 'coffee/fixtures/**/*.underscore', included: false},
{pattern: 'templates/**/*.underscore', included: false},
{pattern: 'common/templates/**/*.underscore', included: false}
];
// override fixture path and other config.
// override fixture path and other config.
var runAndConfigFiles = [
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'coffee/spec/main.js'
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'coffee/src/**/*.js': ['coverage'],
'js/**/!(*spec).js': ['coverage'],
'common/js/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles, runAndConfigFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......
......@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/require.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: false},
{pattern: 'xmodule_js/common_static/js/src/utility.js', included: false},
......@@ -48,6 +48,7 @@ var files = [
{pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/domReady.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/URI.min.js', included: false},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true},
{pattern: 'xmodule_js/src/xmodule.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents.js', included: false},
{pattern: 'xmodule_js/common_static/js/test/i18n.js', included: false},
......@@ -67,48 +68,68 @@ var files = [
pattern: 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js',
included: false
},
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/text.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/requirejs/text.js', included: false}
];
// Paths to source JavaScript files
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true, nocache: true},
{pattern: 'coffee/src/**/*.js', included: false, nocache: true},
{pattern: 'js/collections/**/*.js', included: false, nocache: true},
{pattern: 'js/models/**/*.js', included: false, nocache: true},
{pattern: 'js/utils/**/*.js', included: false, nocache: true},
{pattern: 'js/views/**/*.js', included: false, nocache: true},
{pattern: 'common/js/**/*.js', included: false, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: false},
{pattern: 'js/collections/**/*.js', included: false},
{pattern: 'js/models/**/*.js', included: false},
{pattern: 'js/utils/**/*.js', included: false},
{pattern: 'js/views/**/*.js', included: false},
{pattern: 'common/js/**/*.js', included: false}
];
// Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/**/*.js', included: false, nocache: true},
{pattern: 'js/spec/**/*.js', included: false, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'coffee/spec/**/*.js', included: false},
{pattern: 'js/spec/**/*.js', included: false}
];
// Paths to fixture files
{pattern: 'coffee/fixtures/**/*.*', included: false, nocache: true},
{pattern: 'templates/**/*.*', included: false, nocache: true},
{pattern: 'common/templates/**/*.*', included: false, nocache: true},
// Paths to fixture files
var fixtureFiles = [
{pattern: 'coffee/fixtures/**/*.*', included: false},
{pattern: 'templates/**/*.*', included: false},
{pattern: 'common/templates/**/*.*', included: false}
];
// override fixture path and other config.
// override fixture path and other config.
var runAndConfigFiles = [
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'coffee/spec/main_squire.js'
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'coffee/src/**/*.js': ['coverage'],
'js/collections/**/*.js': ['coverage'],
'js/models/**/*.js': ['coverage'],
'js/utils/**/*.js': ['coverage'],
'js/views/**/*.js': ['coverage'],
'common/js/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles, runAndConfigFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
// override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
......@@ -60,38 +60,66 @@ var files = [
{pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'src/word_cloud/d3.min.js', included: true},
{pattern: 'common_static/js/vendor/draggabilly.js', included: false},
{pattern: 'common_static/edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'common_static/edx-pattern-library/js/modernizr-custom.js', included: false},
{pattern: 'common_static/edx-pattern-library/js/afontgarde.js', included: false},
{pattern: 'common_static/edx-pattern-library/js/edx-icons.js', included: false},
{pattern: 'common_static/edx-pattern-library/js/edx-icons.js', included: false}
];
// Paths to source JavaScript files
{pattern: 'src/xmodule.js', included: true, nocache: true},
{pattern: 'src/**/*.js', included: true, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'src/xmodule.js', included: true, skipInstrument: true},
{pattern: 'src/**/*.js', included: true}
];
// Paths to spec (test) JavaScript files
{pattern: 'spec/helper.js', included: true, nocache: true},
{pattern: 'spec/**/*.js', included: true, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'spec/helper.js', included: true, skipInstrument: true},
{pattern: 'spec/**/*.js', included: true}
];
// Paths to fixture files
{pattern: 'fixtures/*.*', included: false, served: true, nocache: true},
// Paths to fixture files
var fixtureFiles = [
{pattern: 'fixtures/*.*', included: false, served: true}
];
var runAndConfigFiles = [
{pattern: 'karma_runner.js', included: true}
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'src/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
if (!file.skipInstrument) {
preprocessFiles[pattern] = ['coverage'];
}
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles, runAndConfigFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......@@ -185,7 +185,7 @@
return view.hide();
});
});
describe("NotificationView.Mini", function() {
xdescribe("NotificationView.Mini", function() {
var view;
beforeEach(function() {
view = new NotificationView.Mini();
......
......@@ -27,7 +27,7 @@ var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
// Files to load by Karma
var files = [
var libraryFiles = [
// override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
......@@ -48,44 +48,64 @@ var files = [
{pattern: 'coffee/src/jquery.immediateDescendents.js', included: true},
{pattern: 'js/vendor/jquery.leanModal.js', included: true},
{pattern: 'js/vendor/draggabilly.js', included: true},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'edx-pattern-library/js/modernizr-custom.js', included: true},
{pattern: 'edx-pattern-library/js/afontgarde.js', included: true},
{pattern: 'edx-pattern-library/js/edx-icons.js', included: true},
{pattern: 'edx-pattern-library/js/edx-icons.js', included: true}
];
// Paths to source JavaScript files
{pattern: 'js/xblock/**/*.js', included: true, nocache: true},
{pattern: 'coffee/src/**/*.js', included: true, nocache: true},
{pattern: 'js/src/**/*.js', included: true, nocache: true},
{pattern: 'js/capa/src/**/*.js', included: true, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'js/xblock/**/*.js', included: true},
{pattern: 'coffee/src/**/*.js', included: true},
{pattern: 'js/src/**/*.js', included: true},
{pattern: 'js/capa/src/**/*.js', included: true}
];
// Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/**/*.js', included: true, nocache: true},
{pattern: 'js/spec/**/*.js', included: true, nocache: true},
{pattern: 'js/capa/spec/**/*.js', included: true, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'coffee/spec/**/*.js', included: true},
{pattern: 'js/spec/**/*.js', included: true},
{pattern: 'js/capa/spec/**/*.js', included: true}
];
// Paths to fixture files
{pattern: 'js/fixtures/**/*.html', included: false, nocache: true},
{pattern: 'js/capa/fixtures/**/*.html', included: false, nocache: true},
{pattern: 'common/templates/**/*.underscore', included: false, nocache: true}
// Paths to fixture files
var fixtureFiles = [
{pattern: 'js/fixtures/**/*.html', included: false},
{pattern: 'js/capa/fixtures/**/*.html', included: false},
{pattern: 'common/templates/**/*.underscore', included: false}
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'js/xblock/**/*.js': ['coverage'],
'coffee/src/**/*.js': ['coverage'],
'js/src/**/*.js': ['coverage'],
'js/capa/src/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
{pattern: 'js/vendor/jquery.min.js', included: false},
{pattern: 'js/vendor/jasmine-imagediff.js', included: false},
{pattern: 'js/libs/jasmine-stealth.js', included: false},
......@@ -46,34 +46,60 @@ var files = [
{pattern: 'js/test/i18n.js', included: false},
{pattern: 'coffee/src/jquery.immediateDescendents.js', included: false},
{pattern: 'js/vendor/requirejs/text.js', included: false},
{pattern: 'js/vendor/sinon-1.17.0.js', included: false},
{pattern: 'js/vendor/sinon-1.17.0.js', included: false}
];
// Paths to source JavaScript files
{pattern: 'common/js/**/*.js', included: false, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'common/js/**/!(*spec).js', included: false}
];
// Paths to spec (test) JavaScript files
{pattern: 'common/js/spec/**/*.js', included: false, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'common/js/spec/**/*spec.js', included: false}
];
// Paths to fixture files
{pattern: 'common/templates/**/*.*', included: false, nocache: true},
// Paths to fixture files
var fixtureFiles = [
{pattern: 'common/templates/**/*.*', included: false}
];
// override fixture path and other config.
// override fixture path and other config.
var runAndConfigFiles = [
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'common/js/spec/main_requirejs.js'
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'common/js/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles, runAndConfigFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
{pattern: 'xmodule_js/common_static/js/test/i18n.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.js', included: false},
{pattern: 'xmodule_js/common_static/js/src/logger.js', included: false},
......@@ -72,71 +72,90 @@ var files = [
{pattern: 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.core.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.grid.js', included: true},
// Paths to source JavaScript files
{pattern: 'js/**/*.js', included: false, nocache: true},
{pattern: 'coffee/src/**/*.js', included: false, nocache: true},
{pattern: 'common/js/**/*.js', included: false, nocache: true},
{pattern: 'edx-pattern-library/js/**/*.js', included: false, nocache: true},
{pattern: 'edx-ui-toolkit/js/**/*.js', included: false, nocache: true},
{pattern: 'support/js/**/*.js', included: false, nocache: true},
{pattern: 'teams/js/**/*.js', included: false, nocache: true},
{pattern: 'xmodule_js/common_static/coffee/**/*.js', included: false, nocache: true},
// Paths to Jasmine plugins
{pattern: 'xmodule_js/common_static/js/libs/jasmine-waituntil.js', included: true},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true}
];
// Paths to spec (test) JavaScript files
{pattern: 'js/spec/**/*.js', included: false, nocache: true},
{pattern: 'teams/js/spec/**/*.js', included: false, nocache: true},
{pattern: 'support/js/spec/**/*.js', included: false, nocache: true},
// Paths to source JavaScript files
var sourceFiles = [
{pattern: 'js/**/!(*spec).js', included: false},
{pattern: 'coffee/src/**/*.js', included: false},
{pattern: 'common/js/**/*.js', included: false},
{pattern: 'edx-pattern-library/js/**/*.js', included: false},
{pattern: 'edx-ui-toolkit/js/**/*.js', included: false},
{pattern: 'support/js/**/!(*spec).js', included: false},
{pattern: 'teams/js/**/!(*spec).js', included: false},
{pattern: 'xmodule_js/common_static/coffee/**/*.js', included: false}
];
// Paths to fixture files
{pattern: 'js/fixtures/**/*.html', included: false, nocache: true},
{pattern: 'templates/instructor/instructor_dashboard_2/**/*.*', included: false, nocache: true},
{pattern: 'templates/dashboard/**/*.*', included: false, nocache: true},
{pattern: 'templates/edxnotes/**/*.*', included: false, nocache: true},
{pattern: 'templates/fields/**/*.*', included: false, nocache: true},
{pattern: 'templates/student_account/**/*.*', included: false, nocache: true},
{pattern: 'templates/student_profile/**/*.*', included: false, nocache: true},
{pattern: 'templates/verify_student/**/*.*', included: false, nocache: true},
{pattern: 'templates/file-upload.underscore', included: false, nocache: true},
{pattern: 'templates/components/header/**/*.*', included: false, nocache: true},
{pattern: 'templates/components/tabbed/**/*.*', included: false, nocache: true},
{pattern: 'templates/components/card/**/*.*', included: false, nocache: true},
{pattern: 'templates/financial-assistance/**/*.*', included: false, nocache: true},
{pattern: 'templates/search/**/*.*', included: false, nocache: true},
{pattern: 'templates/discovery/**/*.*', included: false, nocache: true},
{pattern: 'common/templates/**/*.*', included: false, nocache: true},
{pattern: 'teams/templates/**/*.*', included: false, nocache: true},
{pattern: 'support/templates/**/*.*', included: false, nocache: true},
{pattern: 'templates/bookmarks/**/*.*', included: false, nocache: true},
{pattern: 'templates/learner_dashboard/**/*.*', included: false, nocache: true},
{pattern: 'templates/ccx/**/*.*', included: false, nocache: true},
// Paths to spec (test) JavaScript files
var specFiles = [
{pattern: 'js/spec/**/*spec.js', included: false},
{pattern: 'teams/js/spec/**/*spec.js', included: false},
{pattern: 'support/js/spec/**/*spec.js', included: false}
];
// override fixture path and other config.
// Paths to fixture files
var fixtureFiles = [
{pattern: 'js/fixtures/**/*.html', included: false},
{pattern: 'templates/instructor/instructor_dashboard_2/**/*.*', included: false},
{pattern: 'templates/dashboard/**/*.*', included: false},
{pattern: 'templates/edxnotes/**/*.*', included: false},
{pattern: 'templates/fields/**/*.*', included: false},
{pattern: 'templates/student_account/**/*.*', included: false},
{pattern: 'templates/student_profile/**/*.*', included: false},
{pattern: 'templates/verify_student/**/*.*', included: false},
{pattern: 'templates/file-upload.underscore', included: false},
{pattern: 'templates/components/header/**/*.*', included: false},
{pattern: 'templates/components/tabbed/**/*.*', included: false},
{pattern: 'templates/components/card/**/*.*', included: false},
{pattern: 'templates/financial-assistance/**/*.*', included: false},
{pattern: 'templates/search/**/*.*', included: false},
{pattern: 'templates/discovery/**/*.*', included: false},
{pattern: 'common/templates/**/*.*', included: false},
{pattern: 'teams/templates/**/*.*', included: false},
{pattern: 'support/templates/**/*.*', included: false},
{pattern: 'templates/bookmarks/**/*.*', included: false},
{pattern: 'templates/learner_dashboard/**/*.*', included: false},
{pattern: 'templates/ccx/**/*.*', included: false}
];
// override fixture path and other config.
var runAndConfigFiles = [
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
{pattern: 'js/spec/main.js', included: true}
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'js/**/*.js': ['coverage'],
'coffee/src/**/*.js': ['coverage'],
'common/js/**/*.js': ['coverage'],
'support/js/**/*.js': ['coverage'],
'teams/js/**/*.js': ['coverage'],
'xmodule_js/common_static/coffee/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles, runAndConfigFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
......
......@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [
var libraryFiles = [
// override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
......@@ -57,34 +57,57 @@ var files = [
{pattern: 'xmodule_js/src/video/*.js', included: true},
{pattern: 'xmodule_js/src/xmodule.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/draggabilly.js', included: false},
{pattern: 'xmodule_js/common_static/edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'xmodule_js/common_static/edx-pattern-library/js/modernizr-custom.js', included: false},
{pattern: 'xmodule_js/common_static/edx-pattern-library/js/afontgarde.js', included: false},
{pattern: 'xmodule_js/common_static/edx-pattern-library/js/edx-icons.js', included: false},
{pattern: 'xmodule_js/common_static/edx-pattern-library/js/edx-icons.js', included: false}
];
// source files
{pattern: 'coffee/src/**/*.js', included: true, nocache: true},
// source files
var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: true}
];
// spec files
{pattern: 'coffee/spec/**/*.js', included: true, nocache: true},
// spec files
var specFiles = [
{pattern: 'coffee/spec/**/*.js', included: true}
];
// Fixtures
{pattern: 'coffee/fixtures/**/*.*', included: true, nocache: true}
// Fixtures
var fixtureFiles = [
{pattern: 'coffee/fixtures/**/*.*', included: true}
];
var preprocessors = {
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'coffee/src/**/*.js': ['coverage']
};
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var preprocessors = (function () {
var preprocessFiles = {};
_.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false),
localConfig = {
files: files,
preprocessors: preprocessors
};
files = _.flatten([libraryFiles, sourceFiles, specFiles, fixtureFiles]),
localConfig;
// add nocache in files if coverage is not set
if (!config.coverage) {
files.forEach(function (f) {
if (_.isObject(f)) {
f.nocache = true;
}
});
}
localConfig = {
files: files,
preprocessors: preprocessors
};
config.set(_.extend(commonConfig, localConfig));
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment