Socket
Socket
Sign inDemoInstall

simple-git

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-git - npm Package Compare versions

Comparing version 1.26.2 to 1.27.0

test.js

2

package.json
{
"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) {

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