Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mf-tools

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mf-tools - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

105

lib/mf-tools/test/testBuilder.js

@@ -85,2 +85,20 @@ // Generated by CoffeeScript 1.6.2

TestBuilder.prototype._getAllTestFiles = function() {
var allFiles, currentFiles, test, testGlob, _ref;
allFiles = [];
_ref = this._testDefinitions;
for (test in _ref) {
testGlob = _ref[test];
currentFiles = glob.sync(testGlob);
allFiles = allFiles.concat(currentFiles);
}
return allFiles;
};
TestBuilder.prototype.runTogether = function() {
this._runTogether = true;
return this;
};
TestBuilder.prototype.tests = function(_testDefinitions) {

@@ -109,9 +127,13 @@ this._testDefinitions = _testDefinitions;

});
_results = [];
for (t in _this._testDefinitions) {
_results.push((function(t) {
return invoke("test:" + t);
})(t));
if (_this._runTogether) {
return _this._runTests(_this._getAllTestFiles(), 'Starting all tests...');
} else {
_results = [];
for (t in _this._testDefinitions) {
_results.push((function(t) {
return invoke("test:" + t);
})(t));
}
return _results;
}
return _results;
});

@@ -125,4 +147,17 @@ return this;

TestBuilder.prototype._runTests = function(testGlob, msg) {
var childEnv, k, v, _ref, _ref1, _ref2,
TestBuilder.prototype._runTests = function(files, msg) {
var file, _i, _len;
if (this._runTogether) {
this._runTestProcess(files, msg);
} else {
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
this._runTestProcess([file], msg);
}
}
};
TestBuilder.prototype._runTestProcess = function(files, msg) {
var child, childEnv, file, k, outFile, v, _ref, _ref1, _ref2,
_this = this;

@@ -139,32 +174,22 @@

}
return glob(testGlob, function(err, files) {
var child, file, outFile, _i, _len, _results;
_results = [];
for (_i = 0, _len = files.length; _i < _len; _i++) {
file = files[_i];
child = exec("" + (_this._testCmd()) + " " + file, {
env: childEnv,
encoding: 'utf8'
}, function(err, stdout, stderr) {
util.puts(stdout);
console.log(stderr);
if (err !== null) {
return _this._retVal = 1;
}
});
if (_this._mochaReporter === 'xunit') {
if (!(fs.readdirSync('.').indexOf('reports') >= 0)) {
fs.mkdirSync('reports');
}
outFile = fs.createWriteStream("reports/" + (file.replace(/^.*[\\\/]/, '')) + ".xml", {
flags: 'w'
});
_results.push(child.stdout.pipe(outFile));
} else {
_results.push(void 0);
}
child = exec("" + (this._testCmd()) + " " + (files.join(' ')), {
env: childEnv,
encodig: 'utf8'
}, function(err, stdout, stderr) {
util.puts(stdout);
console.log(stderr);
if (err !== null) {
return _this._retVal = 1;
}
return _results;
});
if (this._mochaReporter === 'xunit') {
file = files[0];
if (!(fs.readdirSync('.').indexOf('reports') >= 0)) {
fs.mkdirSync('reports');
}
outFile = fs.createWriteStream("reports/" + (file.replace(/^.*[\\\/]/, '')) + ".xml", {
flags: 'w'
});
return child.stdout.pipe(outFile);
}
};

@@ -178,3 +203,9 @@

return this._task("" + taskName, "Run units on " + name, function() {
return _this._runTests(dir, "Starting " + name + " tests...");
return glob(dir, function(err, files) {
if (err != null) {
_this._retVal = 1;
return;
}
return _this._runTests(files, "Starting " + name + " tests...");
});
});

@@ -181,0 +212,0 @@ };

{
"name": "mf-tools",
"description": "Build and test tools.",
"version": "0.1.6",
"version": "0.1.7",
"author": "Mason Browne <mason@massivelyfun.com>",

@@ -6,0 +6,0 @@ "contributors": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc