Added angular-librarian for manage library
This commit is contained in:
parent
9d174550f5
commit
e625f9fd30
44 changed files with 1867 additions and 228 deletions
66
tasks/test.js
Normal file
66
tasks/test.js
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Server = require('karma').Server;
|
||||
|
||||
function run(type) {
|
||||
const config = getConfig(type);
|
||||
const server = new Server(config, function(exitCode) {
|
||||
process.exit(exitCode);
|
||||
});
|
||||
|
||||
server.start();
|
||||
}
|
||||
|
||||
function getConfig(type) {
|
||||
switch (type) {
|
||||
case 'headless':
|
||||
case 'hl':
|
||||
case 'h':
|
||||
return getHeadlessConfig();
|
||||
case 'all':
|
||||
case 'a':
|
||||
return getAllConfig();
|
||||
case 'watch':
|
||||
case 'w':
|
||||
return getWatchConfig();
|
||||
default:
|
||||
return getSingleConfig();
|
||||
}
|
||||
}
|
||||
|
||||
function getSingleConfig() {
|
||||
let config = getHeadlessConfig();
|
||||
|
||||
config.singleRun = true;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function getHeadlessConfig() {
|
||||
let config = getAllConfig();
|
||||
|
||||
config.browsers = ['PhantomJS'];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function getWatchConfig() {
|
||||
let config = getAllConfig(true);
|
||||
|
||||
config.browsers = ['Chrome'];
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
const getAllConfig = (watch) => ({
|
||||
configFile: path.resolve(__dirname, '..', 'karma.conf.js'),
|
||||
webpack: require(path.resolve(__dirname, '..', 'webpack', 'webpack.test.js'))(watch),
|
||||
});
|
||||
|
||||
module.exports = run;
|
||||
|
||||
if (!module.parent) {
|
||||
run(process.argv[2]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue