Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
855fdbd3
Commit
855fdbd3
authored
May 03, 2016
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved all logic from karma config files to karma.common.conf.js.
The config files just declare lists of files.
parent
ecf233c1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
204 additions
and
302 deletions
+204
-302
cms/static/karma_cms.conf.js
+16
-38
cms/static/karma_cms_squire.conf.js
+16
-38
common/lib/xmodule/xmodule/js/karma_xmodule.conf.js
+19
-50
common/static/common/js/karma.common.conf.js
+82
-13
common/static/karma_common.conf.js
+20
-44
common/static/karma_common_requirejs.conf.js
+19
-46
lms/static/karma_lms.conf.js
+16
-38
lms/static/karma_lms_coffee.conf.js
+16
-35
No files found.
cms/static/karma_cms.conf.js
View file @
855fdbd3
...
...
@@ -5,10 +5,10 @@
/*jshint -W079 */
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
var
files
=
{
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
},
...
...
@@ -67,58 +67,36 @@ var libraryFiles = [
{
pattern
:
'edx-ui-toolkit/js/**/*.js'
,
included
:
false
},
{
pattern
:
'common/js/utils/require-serial.js'
,
included
:
true
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
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
var
specFiles
=
[
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
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'coffee/fixtures/**/*.underscore'
,
included
:
false
},
{
pattern
:
'templates/**/*.underscore'
,
included
:
false
},
{
pattern
:
'common/templates/**/*.underscore'
,
included
:
false
}
];
],
// override fixture path and other config.
var
runAndConfigFiles
=
[
runAndConfigFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
'coffee/spec/main.js'
];
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var
preprocessors
=
configModule
.
getPreprocessorObject
(
_
.
flatten
([
sourceFiles
,
specFiles
]));
]
};
module
.
exports
=
function
(
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
=
{
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
configModule
.
configure
({
config
:
config
,
files
:
files
});
};
cms/static/karma_cms_squire.conf.js
View file @
855fdbd3
...
...
@@ -5,10 +5,10 @@
/*jshint -W079 */
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
var
files
=
{
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
},
...
...
@@ -52,59 +52,37 @@ var libraryFiles = [
},
{
pattern
:
'xmodule_js/common_static/js/vendor/requirejs/text.js'
,
included
:
false
},
{
pattern
:
'common/js/utils/require-serial.js'
,
included
:
true
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
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
var
specFiles
=
[
specFiles
:
[
{
pattern
:
'coffee/spec/**/*.js'
,
included
:
false
},
{
pattern
:
'js/spec/**/*.js'
,
included
:
false
}
];
],
// Paths to fixture files
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'coffee/fixtures/**/*.*'
,
included
:
false
},
{
pattern
:
'templates/**/*.*'
,
included
:
false
},
{
pattern
:
'common/templates/**/*.*'
,
included
:
false
}
];
],
// override fixture path and other config.
var
runAndConfigFiles
=
[
runAndConfigFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
'coffee/spec/main_squire.js'
];
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var
preprocessors
=
configModule
.
getPreprocessorObject
(
_
.
flatten
([
sourceFiles
,
specFiles
]));
]
};
module
.
exports
=
function
(
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
=
{
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
configModule
.
configure
({
config
:
config
,
files
:
files
});
};
common/lib/xmodule/xmodule/js/karma_xmodule.conf.js
View file @
855fdbd3
...
...
@@ -6,11 +6,10 @@
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'common_static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
// override fixture path and other config.
var
files
=
{
libraryFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
{
pattern
:
'common_static/js/vendor/jquery.min.js'
,
included
:
true
},
...
...
@@ -46,62 +45,32 @@ var libraryFiles = [
{
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
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
{
pattern
:
'src/xmodule.js'
,
included
:
true
,
skipInstrument
:
true
},
sourceFiles
:
[
{
pattern
:
'src/xmodule.js'
,
included
:
true
,
ignoreCoverage
:
true
},
{
pattern
:
'src/**/*.js'
,
included
:
true
}
];
],
// Paths to spec (test) JavaScript files
var
specFiles
=
[
{
pattern
:
'spec/helper.js'
,
included
:
true
,
skipInstrument
:
true
},
specFiles
:
[
{
pattern
:
'spec/helper.js'
,
included
:
true
,
ignoreCoverage
:
true
},
{
pattern
:
'spec/**/*.js'
,
included
:
true
}
];
],
// Paths to fixture files
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'fixtures/*.*'
,
included
:
false
,
served
:
true
}
];
],
var
runAndConfigFiles
=
[
runAndConfigFiles
:
[
{
pattern
:
'karma_runner.js'
,
included
:
true
}
];
// 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
),
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
=
{
configModule
.
configure
({
config
:
config
,
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
normalizePathsForCoverageFunc
:
function
(
appRoot
,
pattern
)
{
return
pattern
;
},
useRequireJs
:
false
});
};
common/static/common/js/karma.common.conf.js
View file @
855fdbd3
...
...
@@ -124,26 +124,60 @@ function junitSettings(config) {
};
}
var
getPreprocessorObject
=
function
(
files
)
{
var
preprocessFiles
=
{};
var
normalizePathsForCoverage
=
function
(
files
,
normalize_func
)
{
var
filesForCoverage
=
{};
files
.
forEach
(
function
(
file
)
{
var
pattern
=
_
.
isObject
(
file
)
?
file
.
pattern
:
file
;
if
(
_
.
isObject
(
file
)
&&
file
.
ignoreCoverage
)
{
return
;
}
if
(
pattern
.
match
(
/^common
\/
js/
))
{
pattern
=
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
);
}
else
if
(
pattern
.
match
(
/^xmodule_js
\/
common_static/
))
{
pattern
=
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
.
replace
(
/^xmodule_js
\/
common_static
\/
/
,
''
));
var
pattern
=
_
.
isObject
(
file
)
?
file
.
pattern
:
file
;
if
(
normalize_func
)
{
pattern
=
normalize_func
(
appRoot
,
pattern
);
}
else
{
if
(
pattern
.
match
(
/^common
\/
js/
))
{
pattern
=
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
);
}
else
if
(
pattern
.
match
(
/^xmodule_js
\/
common_static/
))
{
pattern
=
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
.
replace
(
/^xmodule_js
\/
common_static
\/
/
,
''
));
}
}
filesForCoverage
[
pattern
]
=
[
'coverage'
];
});
return
filesForCoverage
;
};
preprocessFiles
[
pattern
]
=
[
'coverage'
];
/**
* Sets nocache on each file in the list.
* @param {Object} files
* @param {Bool} enable
* @return {Object}
*/
var
setNocache
=
function
(
files
,
enable
)
{
files
.
forEach
(
function
(
f
)
{
if
(
_
.
isObject
(
f
))
{
f
.
nocache
=
enable
;
}
});
return
files
;
};
return
preprocessFiles
;
/**
* Sets defaults for each file pattern.
* @param {Object} files
* @return {Object}
*/
var
setDefaults
=
function
(
files
)
{
return
files
.
map
(
function
(
f
)
{
var
file
=
_
.
isObject
(
f
)
?
f
:
{
pattern
:
f
};
if
(
!
file
.
included
)
{
f
.
included
=
false
;
}
return
file
;
});
};
var
getConfig
=
function
(
config
,
useRequireJs
)
{
var
get
Base
Config
=
function
(
config
,
useRequireJs
)
{
useRequireJs
=
useRequireJs
===
undefined
?
true
:
useRequireJs
;
var
getFrameworkFiles
=
function
()
{
...
...
@@ -257,8 +291,43 @@ var getConfig = function (config, useRequireJs) {
};
};
var
configure
=
function
(
data
)
{
var
baseConfig
=
getBaseConfig
(
data
.
config
,
data
.
useRequireJs
);
var
files
=
_
.
flatten
(
_
.
map
(
[
'libraryFiles'
,
'sourceFiles'
,
'specFiles'
,
'fixtureFiles'
,
'runAndConfigFiles'
],
function
(
item
)
{
return
data
.
files
[
item
];
}
)
);
files
=
setDefaults
(
files
);
// With nocache=true, Karma always serves the latest files from disk.
// However, that prevents coverage tracking from working.
// So we only set it if coverage tracking is off.
setNocache
(
files
,
!
data
.
config
.
coverage
);
var
filesForCoverage
=
_
.
flatten
(
_
.
map
(
[
'sourceFiles'
,
'specFiles'
],
function
(
item
)
{
return
data
.
files
[
item
];
}
)
);
var
preprocessors
=
_
.
extend
(
{},
data
.
preprocessors
,
normalizePathsForCoverage
(
filesForCoverage
,
data
.
normalizePathsForCoverageFunc
)
);
data
.
config
.
set
(
_
.
extend
(
baseConfig
,
{
files
:
files
,
preprocessors
:
preprocessors
}));
};
module
.
exports
=
{
getConfig
:
getConfig
,
getPreprocessorObject
:
getPreprocessorObject
,
configure
:
configure
,
appRoot
:
appRoot
};
common/static/karma_common.conf.js
View file @
855fdbd3
...
...
@@ -5,12 +5,10 @@
/*jshint -W079 */
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
// Files to load by Karma
var
libraryFiles
=
[
// override fixture path and other config.
var
files
=
{
libraryFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
{
pattern
:
'js/vendor/jquery.min.js'
,
included
:
true
},
...
...
@@ -34,62 +32,40 @@ var libraryFiles = [
{
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
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
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
var
specFiles
=
[
specFiles
:
[
{
pattern
:
'coffee/spec/**/*.js'
,
included
:
true
},
{
pattern
:
'js/spec/**/*.js'
,
included
:
true
},
{
pattern
:
'js/capa/spec/**/*.js'
,
included
:
true
}
];
],
// Paths to fixture files
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'js/fixtures/**/*.html'
,
included
:
false
},
{
pattern
:
'js/capa/fixtures/**/*.html'
,
included
:
false
},
{
pattern
:
'common/templates/**/*.underscore'
,
included
:
false
}
];
],
// 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
;
pattern
=
path
.
join
(
configModule
.
appRoot
,
'/common/static/'
+
pattern
);
preprocessFiles
[
pattern
]
=
[
'coverage'
];
});
runAndConfigFiles
:
[
]
};
return
preprocessFiles
;
}());
var
normalizePathsForCoverageFunc
=
function
(
appRoot
,
pattern
)
{
return
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
);
};
module
.
exports
=
function
(
config
)
{
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
=
{
configModule
.
configure
({
config
:
config
,
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
normalizePathsForCoverageFunc
:
normalizePathsForCoverageFunc
,
useRequireJs
:
false
});
};
common/static/karma_common_requirejs.conf.js
View file @
855fdbd3
...
...
@@ -6,10 +6,10 @@
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
var
files
=
{
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
},
...
...
@@ -30,61 +30,34 @@ var libraryFiles = [
{
pattern
:
'js/vendor/requirejs/text.js'
,
included
:
false
},
{
pattern
:
'js/vendor/sinon-1.17.0.js'
,
included
:
false
},
{
pattern
:
'common/js/utils/require-serial.js'
,
included
:
true
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
sourceFiles
:
[
{
pattern
:
'common/js/**/!(*spec).js'
,
included
:
false
}
];
],
// Paths to spec (test) JavaScript files
var
specFiles
=
[
specFiles
:
[
{
pattern
:
'common/js/spec/**/*spec.js'
,
included
:
false
}
];
],
// Paths to fixture files
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'common/templates/**/*.*'
,
included
:
false
}
];
],
// override fixture path and other config.
var
runAndConfigFiles
=
[
runAndConfigFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
'common/js/spec/main_requirejs.js'
];
// 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
;
pattern
=
path
.
join
(
configModule
.
appRoot
,
'/common/static/'
+
pattern
);
preprocessFiles
[
pattern
]
=
[
'coverage'
];
});
]
};
return
preprocessFiles
;
}());
var
normalizePathsForCoverageFunc
=
function
(
appRoot
,
pattern
)
{
return
path
.
join
(
appRoot
,
'/common/static/'
+
pattern
);
};
module
.
exports
=
function
(
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
=
{
configModule
.
configure
({
config
:
config
,
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
normalizePathsForCoverageFunc
:
normalizePathsForCoverageFunc
});
};
lms/static/karma_lms.conf.js
View file @
855fdbd3
...
...
@@ -5,10 +5,10 @@
/*jshint -W079 */
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
var
files
=
{
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
},
...
...
@@ -57,10 +57,9 @@ var libraryFiles = [
{
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
:
'common/js/utils/require-serial.js'
,
included
:
true
}
];
],
// Paths to source JavaScript files
var
sourceFiles
=
[
sourceFiles
:
[
{
pattern
:
'js/**/!(*spec).js'
,
included
:
false
},
{
pattern
:
'coffee/src/**/*.js'
,
included
:
false
},
{
pattern
:
'common/js/**/*.js'
,
included
:
false
},
...
...
@@ -69,17 +68,15 @@ var sourceFiles = [
{
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 spec (test) JavaScript files
var
specFiles
=
[
specFiles
:
[
{
pattern
:
'js/spec/**/*spec.js'
,
included
:
false
},
{
pattern
:
'teams/js/spec/**/*spec.js'
,
included
:
false
},
{
pattern
:
'support/js/spec/**/*spec.js'
,
included
:
false
}
];
],
// Paths to fixture files
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'js/fixtures/**/*.html'
,
included
:
false
},
{
pattern
:
'templates/instructor/instructor_dashboard_2/**/*.*'
,
included
:
false
},
{
pattern
:
'templates/dashboard/**/*.*'
,
included
:
false
},
...
...
@@ -103,36 +100,17 @@ var fixtureFiles = [
{
pattern
:
'templates/ccx/**/*.*'
,
included
:
false
},
{
pattern
:
'templates/commerce/receipt.underscore'
,
included
:
false
},
{
pattern
:
'templates/api_admin/**/*.*'
,
included
:
false
}
];
],
// override fixture path and other config.
var
runAndConfigFiles
=
[
runAndConfigFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
{
pattern
:
'js/spec/main.js'
,
included
:
true
}
];
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var
preprocessors
=
configModule
.
getPreprocessorObject
(
_
.
flatten
([
sourceFiles
,
specFiles
]));
]
};
module
.
exports
=
function
(
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
=
{
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
configModule
.
configure
({
config
:
config
,
files
:
files
});
};
lms/static/karma_lms_coffee.conf.js
View file @
855fdbd3
...
...
@@ -6,14 +6,12 @@
'use strict'
;
var
path
=
require
(
'path'
);
var
_
=
require
(
'underscore'
);
var
configModule
=
require
(
path
.
join
(
__dirname
,
'../../common/static/common/js/karma.common.conf.js'
));
var
libraryFiles
=
[
// override fixture path and other config.
var
files
=
{
libraryFiles
:
[
{
pattern
:
path
.
join
(
configModule
.
appRoot
,
'common/static/common/js/jasmine.common.conf.js'
),
included
:
true
},
// vendor files
{
pattern
:
'xmodule_js/common_static/js/vendor/jquery.min.js'
,
included
:
true
},
{
pattern
:
'xmodule_js/common_static/js/test/i18n.js'
,
included
:
true
},
{
pattern
:
'xmodule_js/common_static/coffee/src/ajax_prefix.js'
,
included
:
true
},
...
...
@@ -43,45 +41,28 @@ var libraryFiles = [
{
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
}
];
],
// source files
var
sourceFiles
=
[
sourceFiles
:
[
{
pattern
:
'coffee/src/**/*.js'
,
included
:
true
}
];
],
// spec files
var
specFiles
=
[
specFiles
:
[
{
pattern
:
'coffee/spec/**/*.js'
,
included
:
true
}
];
],
// Fixtures
var
fixtureFiles
=
[
fixtureFiles
:
[
{
pattern
:
'coffee/fixtures/**/*.*'
,
included
:
true
}
];
],
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
var
preprocessors
=
configModule
.
getPreprocessorObject
(
_
.
flatten
([
sourceFiles
,
specFiles
]))
;
runAndConfigFiles
:
[
]
}
;
module
.
exports
=
function
(
config
)
{
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
=
{
configModule
.
configure
({
config
:
config
,
files
:
files
,
preprocessors
:
preprocessors
};
config
.
set
(
_
.
extend
(
commonConfig
,
localConfig
));
useRequireJs
:
false
});
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment