Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('karma:dev', function(done) {
const karmaConfigPath = path.resolve('./karma.dev');
const karmaConfig = parseConfig(karmaConfigPath, {});
const karmaServer = new Server(
{
configFile: karmaConfigPath,
singleRun: false,
autoWatch: true,
reporters: [ 'clear-screen' ].concat(karmaConfig.reporters)
},
done
);
karmaServer.start();
});
gulp.task('default', function(done) {
var config = karmaConfigParser(path.resolve('karma.conf.js'), {});
config.singleRun = true;
KarmaServer.start(config, function(exitCode) {
gutil.log('Karma has exited with ' + exitCode);
done();
process.exit(exitCode);
});
});
function runKarma(configFilePath, options, cb) {
configFilePath = path.resolve(configFilePath);
var server = karma.server;
var log = gutil.log;
var colors = gutil.colors;
var config = karmaParseConfig(configFilePath, {});
Object.keys(options).forEach(function(key) {
config[key] = options[key];
});
server.start(config, function(exitCode) {
log('Karma has exited with ' + colors.red(exitCode));
cb();
process.exit(exitCode);
});
}
function runKarma(configFilePath, options, cb) {
configFilePath = path.resolve(configFilePath);
var log = gutil.log;
var colors = gutil.colors;
var config = karmaParseConfig(configFilePath, {});
Object.keys(options).forEach(function(key) {
config[key] = options[key];
});
new Server(config, function(exitCode) {
log('Karma has exited with ' + colors.red(exitCode));
cb();
process.exit(exitCode);
}).start();
}
function runKarma(configFilePath, options, cb) {
configFilePath = path.resolve(configFilePath);
var server = karma.server;
var log = gutil.log, colors = gutil.colors;
var config = karmaParseConfig(configFilePath, {});
Object.keys(options).forEach(function (key) {
config[key] = options[key];
});
server.start(config, function (exitCode) {
log('Karma has exited with ' + colors.red(exitCode));
cb();
process.exit(exitCode);
});
}
grunt.task.registerMultiTask('sauce', 'Run tests under Karma on Saucelabs', function() {
var done = this.async();
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config-ci.js'), {});
var config = targetConfig[this.target];
karmaConfig.files = ['test/karma-setup.js'].concat(config.src, config.test);
karmaConfig.sauceLabs.testName = 'web-animation-next ' + this.target + ' Unit tests';
var karmaServer = require('karma').server;
karmaServer.start(karmaConfig, function(exitCode) {
done(exitCode === 0);
});
});
logger.setup('INFO', false);
var log = Util.createLogger(logger);
var karmaConfig = {
singleRun: true,
browsers: [],
reporters: [],
colors: false,
logLevel: 'INFO'
};
if (_.isObject(config.config)) {
karmaConfig = extend(karmaConfig, config.config);
}
return cfg.parseConfig(karmaConfigFile, karmaConfig);
}
logger.setup('INFO', false);
var karmaConfig: any = {
configFile: karmaConfigFile,
singleRun: true,
browsers: [],
reporters: [],
colors: false,
logLevel: 'INFO'
};
if (_.isObject(config.config)) {
karmaConfig = extend(karmaConfig, config.config);
}
Globals.origConfig = cfg.parseConfig(karmaConfigFile, karmaConfig);
karmaConfig = extend({}, Globals.origConfig, extensions);
baseDir = karmaConfig.basePath;
return karmaConfig;
}
return new Promise(function(resolve) {
var karmaConfig = require('karma/lib/config').parseConfig(require('path').resolve('test/karma-config.js'), {});
configCallback(karmaConfig);
var karmaServer = require('karma').server;
karmaServer.start(karmaConfig, function(exitCode) {
resolve(exitCode == 0);
});
});
}