simple-git
Advanced tools
Comparing version 1.26.2 to 1.27.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.26.2", | ||
"version": "1.27.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -904,2 +904,6 @@ (function () { | ||
spawned.on('error', function (err) { | ||
stdErr.push(new Buffer(err.stack, 'ascii')); | ||
}); | ||
spawned.on('close', function (exitCode, exitSignal) { | ||
@@ -906,0 +910,0 @@ delete this._childProcess; |
function MockBuffer (content, type) { | ||
this.type = type; | ||
this.toString = function () { return content; } | ||
} | ||
MockBuffer.concat = function () { | ||
}; | ||
function MockChild () { | ||
@@ -23,13 +32,32 @@ mockChildProcesses.push(this); | ||
return git = new Git(baseDir, new MockChildProcess, {concat: sinon.spy(function (things) { return [].join.call(things, '\n'); })}); | ||
var Buffer = MockBuffer; | ||
Buffer.concat = sinon.spy(function (things) { | ||
return [].join.call(things, '\n'); }); | ||
return git = new Git(baseDir, new MockChildProcess, Buffer); | ||
} | ||
function closeWith (data) { | ||
var stdout = mockChildProcesses[mockChildProcesses.length - 1].stdout.on.args[0][1]; | ||
var close = mockChildProcesses[mockChildProcesses.length - 1].on.args[0][1]; | ||
if (typeof data === "string") { | ||
mockChildProcesses[mockChildProcesses.length - 1].stdout.on.args[0][1](data); | ||
} | ||
stdout(data); | ||
close(0); | ||
mockChildProcesses[mockChildProcesses.length - 1].on.args.forEach(function (handler) { | ||
if (handler[0] === 'close') { | ||
handler[1](typeof data === "number" ? data : 0); | ||
} | ||
}); | ||
} | ||
function errorWith (someMessage) { | ||
var handlers = mockChildProcesses[mockChildProcesses.length - 1].on.args; | ||
handlers.forEach(function (handler) { | ||
if (handler[0] === 'error') { | ||
handler[1]({ | ||
stack: someMessage | ||
}); | ||
} | ||
}); | ||
} | ||
function theCommandRun() { | ||
@@ -54,2 +82,20 @@ return mockChildProcess.spawn.args[0][1]; | ||
exports.childProcess = { | ||
setUp: function (done) { | ||
Instance(); | ||
done() | ||
}, | ||
'handles child process errors': function (test) { | ||
git.init(function (err) { | ||
test.equals('SOME ERROR', err); | ||
test.done(); | ||
}); | ||
errorWith('SOME ERROR'); | ||
closeWith(-2); | ||
} | ||
}; | ||
exports.commit = { | ||
@@ -56,0 +102,0 @@ setUp: function (done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72627
12
1715
3