feat: new Web UI build system
- use generator-gulp-angular by @swiip - remove old static file
This commit is contained in:
parent
587b17c120
commit
b7a71edfcb
83 changed files with 1069 additions and 1028 deletions
52
webui/gulp/unit-tests.js
Normal file
52
webui/gulp/unit-tests.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var gulp = require('gulp');
|
||||
var conf = require('./conf');
|
||||
|
||||
var karma = require('karma');
|
||||
|
||||
var pathSrcHtml = [
|
||||
path.join(conf.paths.src, '/**/*.html')
|
||||
];
|
||||
|
||||
var pathSrcJs = [
|
||||
path.join(conf.paths.src, '/**/!(*.spec).js')
|
||||
];
|
||||
|
||||
function runTests (singleRun, done) {
|
||||
var reporters = ['progress'];
|
||||
var preprocessors = {};
|
||||
|
||||
pathSrcHtml.forEach(function(path) {
|
||||
preprocessors[path] = ['ng-html2js'];
|
||||
});
|
||||
|
||||
if (singleRun) {
|
||||
pathSrcJs.forEach(function(path) {
|
||||
preprocessors[path] = ['coverage'];
|
||||
});
|
||||
reporters.push('coverage')
|
||||
}
|
||||
|
||||
var localConfig = {
|
||||
configFile: path.join(__dirname, '/../karma.conf.js'),
|
||||
singleRun: singleRun,
|
||||
autoWatch: !singleRun,
|
||||
reporters: reporters,
|
||||
preprocessors: preprocessors
|
||||
};
|
||||
|
||||
var server = new karma.Server(localConfig, function(failCount) {
|
||||
done(failCount ? new Error("Failed " + failCount + " tests.") : null);
|
||||
})
|
||||
server.start();
|
||||
}
|
||||
|
||||
gulp.task('test', ['scripts'], function(done) {
|
||||
runTests(true, done);
|
||||
});
|
||||
|
||||
gulp.task('test:auto', ['watch'], function(done) {
|
||||
runTests(false, done);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue