Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var spawn = require('child_process').spawn;
var chalk = require('chalk');
var vow = require('vow');
var vowFs = require('vow-fs');
var SOURCES = ['lib', 'test/specs'];
var MOCHA = 'node_modules/.bin/mocha';
/**
* Applying passed presets to JSCS sources and tests, then executing tests.
* So we can make sure nothing breaks during these reformatting actions.
*/
var presets = process.env.TEST_PRESET && vow.resolve(process.env.TEST_PRESET.split(','));
/**
* Or applying every available preset if nothing passed and do the same.
*/
presets = presets || vowFs.listDir('./presets')
.then(function(presetFilenames) {
var presets = presetFilenames.map(function(presetFilename) {
return presetFilename.replace('.json', '');
});
// List of rules that are not used in any of the default presets
presets.unshift('./test/scripts/forgotten-rules.json');
return presets;
});
this.save = function (options) {
logger.debug(util.format('save data to file %s', options.path), module);
var promise = options.archive ?
gzip(options.data) : vow.resolve(options.data);
return promise.then(function (data) {
return vowFs.write(options.path, data, 'utf8');
});
};
save: function (options) {
logger.debug('save data to file file %s', options.path ? options.path : 'unknown file');
var promise = options.archive ? util.zip(options.data) : vow.resolve(options.data);
return promise.then(function (data) {
return vowFs.write(options.path, data, 'utf8');
});
},
makeForTesting: function (version, env) {
var promise = version ? vow.resolve() : makeSnapshot();
return promise.then(function (snapshot) {
return version ? vow.resolve() : uploadSnapshot(snapshot);
})
.then(function () {
return setSnapshotActive(providers.getProviderYaDisk(), env, version);
});
},
makeForProduction: function (version, env) {
makeForDevelopment: function (version) {
var promise = version ? vow.resolve() : makeSnapshot();
return promise.then(function () {
return setSnapshotActive(providers.getProviderFile(), '', version);
});
},
makeForTesting: function (version, env) {