Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
args.browsers = (args.browser || 'chrome').split(',');
args.sauce = args.sauce ? true : false;
var BROWSERS = ['chrome', 'firefox'];
if (args.sauce) { BROWSERS.push('explorer'); }
var MOBILE_BROWSERS = ['android', 'ios', 'iphone', 'ipad', 'android_phone'];
process.env.SAUCE_CONNECT_VERSION = process.env.SAUCE_CONNECT_VERSION || '4.5.1';
process.env.SAUCE_CONNECT_VERBOSE = false;
var PROXY_PORT = 5050;
var expressPort = 3000; // incremented after each test to avoid collision
var debugLog = log.bind(log);
var warnLog = log.warn.bind(log);
var errorLog = log.error.bind(log);
function buildMochaOpts(opts) {
var mochaOpts = {
flags: {
u: 'bdd-with-opts',
R: 'spec',
c: true,
},
exit: true,
bin: path.join(__dirname, 'node_modules/.bin/' + ((process.platform !== "win32") ? 'mocha' : 'mocha.cmd')),
concurrency: args.concurrency | process.env.CONCURRENCY || 3
};
if(args.grep) {
mochaOpts.flags.g = args.grep;
function rebundle(file) {
if (file) {
log('Rebundling,', path.basename(file[0]), 'has changes.');
}
return this.bundle()
.on('error', log.bind(log, 'Browserify Error')) // log errors if they happen
.pipe(source(outfile))
.pipe(buffer())
.pipe(gulp.dest(outdir)) //generate the non-minified
.pipe(rename({extname:'.min.js'}))
.pipe(sourcemaps.init({loadMaps:true, debug:true})) // init source map
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(outdir));
}
gulp.task('vendorScripts', function () {
// Ensure package is updated.
readPackage()
var vb = browserify({
debug: true,
require: pkg.dependencies ? Object.keys(pkg.dependencies) : []
})
return vb.bundle()
.on('error', log.bind(log, 'Browserify Error'))
.pipe(source('vendor.js'))
.pipe(buffer())
.pipe($.sourcemaps.init({ loadMaps: true }))
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest('.tmp/assets/scripts/'))
.pipe(bs.stream())
})
function (cb) {
var self = this;
var logger = fancyLog.bind(PLUGIN_NAME);
try {
deploy(opt, files, logger, function (err) {
if (err) {
self.emit('error', new pluginError(PLUGIN_NAME, err));
} else {
self.emit('end');
}
cb();
})
} catch (err) {
self.emit('error', new pluginError(PLUGIN_NAME, err));
cb();
}
});
};