Commit 3507792b by Ehtesham Committed by Usman Khalid

coverage fixes

parent aee139ae
...@@ -26,7 +26,7 @@ var path = require('path'); ...@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); 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/coffee/src/ajax_prefix.js', included: false},
{pattern: 'xmodule_js/common_static/js/src/utility.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}, {pattern: 'xmodule_js/common_static/js/vendor/jquery.min.js', included: false},
...@@ -48,6 +48,7 @@ var files = [ ...@@ -48,6 +48,7 @@ var files = [
{pattern: 'xmodule_js/common_static/js/vendor/Squire.js', included: false}, {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-stealth.js', included: false},
{pattern: 'xmodule_js/common_static/js/libs/jasmine-waituntil.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/jasmine-imagediff.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/CodeMirror/codemirror.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}, {pattern: 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/**/*.js', included: false},
...@@ -76,48 +77,67 @@ var files = [ ...@@ -76,48 +77,67 @@ var files = [
}, },
{pattern: 'xmodule_js/common_static/js/vendor/mock-ajax.js', included: false}, {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: 'xmodule_js/common_static/js/vendor/requirejs/text.js', included: false},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.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/modernizr-custom.js', included: false},
{pattern: 'edx-pattern-library/js/afontgarde.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/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 // Paths to source JavaScript files
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true, nocache: true}, var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: false, nocache: true}, {pattern: 'coffee/src/**/!(*spec).js', included: false},
{pattern: 'js/**/*.js', included: false, nocache: true}, {pattern: 'js/**/!(*spec).js', included: false},
{pattern: 'js/certificates/**/*.js', included: false, nocache: true}, {pattern: 'common/js/**/!(*spec).js', included: false}
{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 spec (test) JavaScript files // Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/main.js', included: false, nocache: true}, var specFiles = [
{pattern: 'coffee/spec/**/*.js', included: false, nocache: true}, {pattern: 'coffee/spec/**/*spec.js', included: false},
{pattern: 'js/spec/**/*.js', included: false, nocache: true}, {pattern: 'js/spec/**/*spec.js', included: false},
{pattern: 'js/certificates/spec/**/*.js', included: false, nocache: true}, {pattern: 'js/certificates/spec/**/*spec.js', included: false}
];
// Paths to fixture files // Paths to fixture files
{pattern: 'coffee/fixtures/**/*.underscore', included: false, nocache: true}, var fixtureFiles = [
{pattern: 'templates/**/*.underscore', included: false, nocache: true}, {pattern: 'coffee/fixtures/**/*.underscore', included: false},
{pattern: 'common/templates/**/*.underscore', included: false, nocache: true}, {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}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'coffee/spec/main.js' 'coffee/spec/main.js'
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'coffee/src/**/*.js': ['coverage'], var preprocessFiles = {};
'js/**/!(*spec).js': ['coverage'], _.flatten([sourceFiles, specFiles]).forEach(function (file) {
'common/js/**/*.js': ['coverage'] var pattern = _.isObject(file) ? file.pattern : file;
}; preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config), var commonConfig = configModule.getConfig(config),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -26,7 +26,7 @@ var path = require('path'); ...@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); 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/js/vendor/requirejs/require.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.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}, {pattern: 'xmodule_js/common_static/js/src/utility.js', included: false},
...@@ -48,6 +48,7 @@ var files = [ ...@@ -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/CodeMirror/codemirror.js', included: false},
{pattern: 'xmodule_js/common_static/js/vendor/domReady.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/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/src/xmodule.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/jquery.immediateDescendents.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}, {pattern: 'xmodule_js/common_static/js/test/i18n.js', included: false},
...@@ -67,44 +68,64 @@ var files = [ ...@@ -67,44 +68,64 @@ var files = [
pattern: 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js', pattern: 'xmodule_js/common_static/js/vendor/jQuery-File-Upload/js/jquery.fileupload-validate.js',
included: false 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 // Paths to source JavaScript files
{pattern: 'xmodule_js/common_static/js/libs/jasmine-extensions.js', included: true, nocache: true}, var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: false, nocache: true}, {pattern: 'coffee/src/**/*.js', included: false},
{pattern: 'js/collections/**/*.js', included: false, nocache: true}, {pattern: 'js/collections/**/*.js', included: false},
{pattern: 'js/models/**/*.js', included: false, nocache: true}, {pattern: 'js/models/**/*.js', included: false},
{pattern: 'js/utils/**/*.js', included: false, nocache: true}, {pattern: 'js/utils/**/*.js', included: false},
{pattern: 'js/views/**/*.js', included: false, nocache: true}, {pattern: 'js/views/**/*.js', included: false},
{pattern: 'common/js/**/*.js', included: false, nocache: true}, {pattern: 'common/js/**/*.js', included: false}
];
// Paths to spec (test) JavaScript files // Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/**/*.js', included: false, nocache: true}, var specFiles = [
{pattern: 'js/spec/**/*.js', included: false, nocache: true}, {pattern: 'coffee/spec/**/*.js', included: false},
{pattern: 'js/spec/**/*.js', included: false}
];
// Paths to fixture files // Paths to fixture files
{pattern: 'coffee/fixtures/**/*.*', included: false, nocache: true}, var fixtureFiles = [
{pattern: 'templates/**/*.*', included: false, nocache: true}, {pattern: 'coffee/fixtures/**/*.*', included: false},
{pattern: 'common/templates/**/*.*', included: false, nocache: true}, {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}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'coffee/spec/main_squire.js' 'coffee/spec/main_squire.js'
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'coffee/src/**/*.js': ['coverage'], var preprocessFiles = {};
'js/collections/**/*.js': ['coverage'], _.flatten([sourceFiles, specFiles]).forEach(function (file) {
'js/models/**/*.js': ['coverage'], var pattern = _.isObject(file) ? file.pattern : file;
'js/utils/**/*.js': ['coverage'], preprocessFiles[pattern] = ['coverage'];
'js/views/**/*.js': ['coverage'], });
'common/js/**/*.js': ['coverage']
}; return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config), var commonConfig = configModule.getConfig(config),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -27,7 +27,7 @@ var path = require('path'); ...@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js')); var configModule = require(path.join(__dirname, 'common_static/common/js/karma.common.conf.js'));
var files = [ var libraryFiles = [
// override fixture path and other config. // override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
...@@ -60,34 +60,62 @@ var files = [ ...@@ -60,34 +60,62 @@ var files = [
{pattern: 'spec/main_requirejs.js', included: true}, {pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'src/word_cloud/d3.min.js', included: true}, {pattern: 'src/word_cloud/d3.min.js', included: true},
{pattern: 'common_static/js/vendor/draggabilly.js', included: false}, {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-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/modernizr-custom.js', included: false},
{pattern: 'common_static/edx-pattern-library/js/afontgarde.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 // Paths to source JavaScript files
{pattern: 'src/xmodule.js', included: true, nocache: true}, var sourceFiles = [
{pattern: 'src/**/*.js', included: true, nocache: true}, {pattern: 'src/xmodule.js', included: true, skipInstrument: true},
{pattern: 'src/**/*.js', included: true}
];
// Paths to spec (test) JavaScript files // Paths to spec (test) JavaScript files
{pattern: 'spec/helper.js', included: true, nocache: true}, var specFiles = [
{pattern: 'spec/**/*.js', included: true, nocache: true}, {pattern: 'spec/helper.js', included: true, skipInstrument: true},
{pattern: 'spec/**/*.js', included: true}
];
// Paths to fixture files // Paths to fixture files
{pattern: 'fixtures/*.*', included: false, served: true, nocache: true}, var fixtureFiles = [
{pattern: 'fixtures/*.*', included: false, served: true}
];
var runAndConfigFiles = [
{pattern: 'karma_runner.js', included: true} {pattern: 'karma_runner.js', included: true}
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'src/**/*.js': ['coverage'] 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) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false), var commonConfig = configModule.getConfig(config, false),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
return view.hide(); return view.hide();
}); });
}); });
describe("NotificationView.Mini", function() { xdescribe("NotificationView.Mini", function() {
var view; var view;
beforeEach(function() { beforeEach(function() {
view = new NotificationView.Mini(); view = new NotificationView.Mini();
......
...@@ -27,7 +27,7 @@ var _ = require('underscore'); ...@@ -27,7 +27,7 @@ var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
// Files to load by Karma // Files to load by Karma
var files = [ var libraryFiles = [
// override fixture path and other config. // override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
...@@ -48,40 +48,60 @@ var files = [ ...@@ -48,40 +48,60 @@ var files = [
{pattern: 'coffee/src/jquery.immediateDescendents.js', included: true}, {pattern: 'coffee/src/jquery.immediateDescendents.js', included: true},
{pattern: 'js/vendor/jquery.leanModal.js', included: true}, {pattern: 'js/vendor/jquery.leanModal.js', included: true},
{pattern: 'js/vendor/draggabilly.js', included: true}, {pattern: 'js/vendor/draggabilly.js', included: true},
{pattern: 'edx-ui-toolkit/js/utils/global-loader.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/modernizr-custom.js', included: true},
{pattern: 'edx-pattern-library/js/afontgarde.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 // Paths to source JavaScript files
{pattern: 'js/xblock/**/*.js', included: true, nocache: true}, var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: true, nocache: true}, {pattern: 'js/xblock/**/*.js', included: true},
{pattern: 'js/src/**/*.js', included: true, nocache: true}, {pattern: 'coffee/src/**/*.js', included: true},
{pattern: 'js/capa/src/**/*.js', included: true, nocache: true}, {pattern: 'js/src/**/*.js', included: true},
{pattern: 'js/capa/src/**/*.js', included: true}
];
// Paths to spec (test) JavaScript files // Paths to spec (test) JavaScript files
{pattern: 'coffee/spec/**/*.js', included: true, nocache: true}, var specFiles = [
{pattern: 'js/spec/**/*.js', included: true, nocache: true}, {pattern: 'coffee/spec/**/*.js', included: true},
{pattern: 'js/capa/spec/**/*.js', included: true, nocache: true}, {pattern: 'js/spec/**/*.js', included: true},
{pattern: 'js/capa/spec/**/*.js', included: true}
];
// Paths to fixture files // Paths to fixture files
{pattern: 'js/fixtures/**/*.html', included: false, nocache: true}, var fixtureFiles = [
{pattern: 'js/capa/fixtures/**/*.html', included: false, nocache: true}, {pattern: 'js/fixtures/**/*.html', included: false},
{pattern: 'common/templates/**/*.underscore', included: false, nocache: true} {pattern: 'js/capa/fixtures/**/*.html', included: false},
{pattern: 'common/templates/**/*.underscore', included: false}
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'js/xblock/**/*.js': ['coverage'], var preprocessFiles = {};
'coffee/src/**/*.js': ['coverage'], _.flatten([sourceFiles, specFiles]).forEach(function (file) {
'js/src/**/*.js': ['coverage'], var pattern = _.isObject(file) ? file.pattern : file;
'js/capa/src/**/*.js': ['coverage'] preprocessFiles[pattern] = ['coverage'];
}; });
return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false), var commonConfig = configModule.getConfig(config, false),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -27,7 +27,7 @@ var path = require('path'); ...@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); 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/jquery.min.js', included: false},
{pattern: 'js/vendor/jasmine-imagediff.js', included: false}, {pattern: 'js/vendor/jasmine-imagediff.js', included: false},
{pattern: 'js/libs/jasmine-stealth.js', included: false}, {pattern: 'js/libs/jasmine-stealth.js', included: false},
...@@ -46,30 +46,56 @@ var files = [ ...@@ -46,30 +46,56 @@ var files = [
{pattern: 'js/test/i18n.js', included: false}, {pattern: 'js/test/i18n.js', included: false},
{pattern: 'coffee/src/jquery.immediateDescendents.js', included: false}, {pattern: 'coffee/src/jquery.immediateDescendents.js', included: false},
{pattern: 'js/vendor/requirejs/text.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 // Paths to source JavaScript files
{pattern: 'common/js/**/*.js', included: false, nocache: true}, var sourceFiles = [
{pattern: 'common/js/**/!(*spec).js', included: false}
];
// Paths to spec (test) JavaScript files // Paths to spec (test) JavaScript files
{pattern: 'common/js/spec/**/*.js', included: false, nocache: true}, var specFiles = [
{pattern: 'common/js/spec/**/*spec.js', included: false}
];
// Paths to fixture files // Paths to fixture files
{pattern: 'common/templates/**/*.*', included: false, nocache: true}, 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}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
'common/js/spec/main_requirejs.js' 'common/js/spec/main_requirejs.js'
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'common/js/**/*.js': ['coverage'] var preprocessFiles = {};
}; _.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config), var commonConfig = configModule.getConfig(config),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -26,7 +26,7 @@ var path = require('path'); ...@@ -26,7 +26,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); 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/js/test/i18n.js', included: false},
{pattern: 'xmodule_js/common_static/coffee/src/ajax_prefix.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}, {pattern: 'xmodule_js/common_static/js/src/logger.js', included: false},
...@@ -72,67 +72,86 @@ var files = [ ...@@ -72,67 +72,86 @@ var files = [
{pattern: 'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2.js', included: true}, {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.core.js', included: true},
{pattern: 'xmodule_js/common_static/js/vendor/slick.grid.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-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 // Paths to source JavaScript files
{pattern: 'js/spec/**/*.js', included: false, nocache: true}, var sourceFiles = [
{pattern: 'teams/js/spec/**/*.js', included: false, nocache: true}, {pattern: 'js/**/!(*spec).js', included: false},
{pattern: 'support/js/spec/**/*.js', included: false, nocache: true}, {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 // Paths to spec (test) JavaScript files
{pattern: 'js/fixtures/**/*.html', included: false, nocache: true}, var specFiles = [
{pattern: 'templates/instructor/instructor_dashboard_2/**/*.*', included: false, nocache: true}, {pattern: 'js/spec/**/*spec.js', included: false},
{pattern: 'templates/dashboard/**/*.*', included: false, nocache: true}, {pattern: 'teams/js/spec/**/*spec.js', included: false},
{pattern: 'templates/edxnotes/**/*.*', included: false, nocache: true}, {pattern: 'support/js/spec/**/*spec.js', included: false}
{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},
// 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: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
{pattern: 'js/spec/main.js', included: true} {pattern: 'js/spec/main.js', included: true}
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'js/**/*.js': ['coverage'], var preprocessFiles = {};
'coffee/src/**/*.js': ['coverage'], _.flatten([sourceFiles, specFiles]).forEach(function (file) {
'common/js/**/*.js': ['coverage'], var pattern = _.isObject(file) ? file.pattern : file;
'support/js/**/*.js': ['coverage'], preprocessFiles[pattern] = ['coverage'];
'teams/js/**/*.js': ['coverage'], });
'xmodule_js/common_static/coffee/**/*.js': ['coverage']
}; return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config), var commonConfig = configModule.getConfig(config),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
...@@ -27,7 +27,7 @@ var path = require('path'); ...@@ -27,7 +27,7 @@ var path = require('path');
var _ = require('underscore'); var _ = require('underscore');
var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js')); var configModule = require(path.join(__dirname, '../../common/static/common/js/karma.common.conf.js'));
var files = [ var libraryFiles = [
// override fixture path and other config. // override fixture path and other config.
{pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true}, {pattern: path.join(configModule.appRoot, 'common/static/common/js/jasmine.common.conf.js'), included: true},
...@@ -57,30 +57,53 @@ var files = [ ...@@ -57,30 +57,53 @@ var files = [
{pattern: 'xmodule_js/src/video/*.js', included: true}, {pattern: 'xmodule_js/src/video/*.js', included: true},
{pattern: 'xmodule_js/src/xmodule.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/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-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/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/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 // source files
{pattern: 'coffee/src/**/*.js', included: true, nocache: true}, var sourceFiles = [
{pattern: 'coffee/src/**/*.js', included: true}
];
// spec files // spec files
{pattern: 'coffee/spec/**/*.js', included: true, nocache: true}, var specFiles = [
{pattern: 'coffee/spec/**/*.js', included: true}
];
// Fixtures // Fixtures
{pattern: 'coffee/fixtures/**/*.*', included: true, nocache: true} var fixtureFiles = [
{pattern: 'coffee/fixtures/**/*.*', included: true}
]; ];
var preprocessors = { // do not include tests or libraries
// do not include tests or libraries // (these files will be instrumented by Istanbul)
// (these files will be instrumented by Istanbul) var preprocessors = (function () {
'coffee/src/**/*.js': ['coverage'] var preprocessFiles = {};
}; _.flatten([sourceFiles, specFiles]).forEach(function (file) {
var pattern = _.isObject(file) ? file.pattern : file;
preprocessFiles[pattern] = ['coverage'];
});
return preprocessFiles;
}());
module.exports = function (config) { module.exports = function (config) {
var commonConfig = configModule.getConfig(config, false), var commonConfig = configModule.getConfig(config, false),
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 = { localConfig = {
files: files, files: files,
preprocessors: preprocessors preprocessors: preprocessors
......
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