git-commit-file
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -5,2 +5,3 @@ #!/usr/bin/env node | ||
const main = require('../index') | ||
const args = yargs.argv._ | ||
@@ -13,6 +14,4 @@ let arg | ||
console.log('GLOBAL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') | ||
console.log(process.env) | ||
console.log('GLOBAL XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') | ||
process.env.NODE_IS_GLOBAL = true | ||
main(arg) |
const chai = require('chai') | ||
const sinon = require('sinon') | ||
const sinonChai = require('sinon-chai') | ||
const expect = chai.expect | ||
chai.use(sinonChai) | ||
const expect = chai.expect | ||
const {name} = require('../package.json') | ||
const helper = require('./helper') | ||
const gcf = require('./gcf') | ||
const helper = require('./helper') | ||
const {name} = require('../package.json') | ||
@@ -22,2 +22,3 @@ describe(name, () => { | ||
beforeEach(function() { | ||
delete process.env.NODE_IS_GLOBAL | ||
sandbox = sinon.sandbox.create() | ||
@@ -35,2 +36,11 @@ greenSpy = sandbox.spy(helper, 'green') | ||
const checkSuccessExpectations = (filename, exitCode) => { | ||
expect(addStub).to.have.been.calledWith(filename) | ||
expect(commitStub).to.have.been.calledWith(filename) | ||
expect(greenSpy).to.have.been.calledWith(`Committed ${filename}`) | ||
expect(exitCode).to.equal(0) | ||
} | ||
it('exits with 0 when filename given', () => { | ||
@@ -41,9 +51,14 @@ | ||
const exitCode = gcf(filename) | ||
checkSuccessExpectations(filename, exitCode) | ||
expect(webpackStub).to.have.not.been.called | ||
}) | ||
it('exits with 0 when filename given and node is global', () => { | ||
process.env.NODE_IS_GLOBAL = true | ||
const filename = 'myFile' | ||
initStubs({}) | ||
const exitCode = gcf(filename) | ||
checkSuccessExpectations(filename, exitCode) | ||
expect(webpackStub).to.have.not.been.called | ||
expect(addStub).to.have.been.calledWith(filename) | ||
expect(commitStub).to.have.been.calledWith(filename) | ||
expect(greenSpy).to.have.been.calledWith('Committed ' + filename) | ||
expect(exitCode).to.equal(0) | ||
}) | ||
@@ -56,9 +71,4 @@ | ||
const exitCode = gcf() | ||
checkSuccessExpectations(filename, exitCode) | ||
expect(webpackStub).to.have.been.called | ||
expect(addStub).to.have.been.calledWith(filename) | ||
expect(commitStub).to.have.been.calledWith(filename) | ||
expect(greenSpy).to.have.been.calledWith(`Committed ${filename}`) | ||
expect(exitCode).to.equal(0) | ||
}) | ||
@@ -69,8 +79,4 @@ }) | ||
it('exits with 1 and warning when git add exits with code 1', () => { | ||
const checkWarningExpectations = (filename, exitCode) => { | ||
const filename = 'myFile' | ||
initStubs({add: {code: 1}}) | ||
const exitCode = gcf(filename) | ||
expect(webpackStub).to.have.not.been.called | ||
@@ -82,2 +88,10 @@ expect(addStub).to.have.been.calledWith(filename) | ||
expect(exitCode).to.equal(1) | ||
} | ||
it('exits with 1 and warning when git add exits with code 1', () => { | ||
const filename = 'myFile' | ||
initStubs({add: {code: 1}}) | ||
const exitCode = gcf(filename) | ||
checkWarningExpectations(filename, exitCode) | ||
}) | ||
@@ -90,9 +104,3 @@ | ||
const exitCode = gcf(filename) | ||
expect(webpackStub).to.have.not.been.called | ||
expect(addStub).to.have.been.calledWith(filename) | ||
expect(commitStub).to.have.been.calledWith(filename) | ||
expect(yellowSpy).to.have.been.calledWith(`Did not commit ${filename}`) | ||
expect(exitCode).to.equal(1) | ||
checkWarningExpectations(filename, exitCode) | ||
}) | ||
@@ -99,0 +107,0 @@ }) |
@@ -31,5 +31,7 @@ const chalk = require('chalk') | ||
/* istanbul ignore else */ | ||
if (testing) return exitCode | ||
/* istanbul ignore next */ | ||
process.exit(exitCode) | ||
if (process.env.NODE_IS_GLOBAL !== 'true' || testing) { | ||
return exitCode | ||
} else { | ||
process.exit(exitCode) | ||
} | ||
}, | ||
@@ -36,0 +38,0 @@ |
{ | ||
"name": "git-commit-file", | ||
"version": "1.0.7", | ||
"description": "Git commit a single file in a single command", | ||
"version": "1.0.8", | ||
"description": "Git add and commit a single file in a single command", | ||
"author": "danday74", | ||
@@ -34,3 +34,22 @@ "license": "ISC", | ||
}, | ||
"keywords": [], | ||
"keywords": [ | ||
"git", | ||
"add", | ||
"commit", | ||
"file", | ||
"command", | ||
"one", | ||
"single", | ||
"local", | ||
"global", | ||
"webpack", | ||
"config", | ||
"output", | ||
"filename", | ||
"webpack.config.output.filename", | ||
"webpack.config.output", | ||
"webpack.output.filename", | ||
"webpack.output", | ||
"output.filename" | ||
], | ||
"repository": { | ||
@@ -37,0 +56,0 @@ "type": "git", |
@@ -9,2 +9,2 @@ # git-commit-file | ||
**Git commit a single file in a single command** | ||
**Git add and commit a single file in a single command** |
@@ -1,2 +0,1 @@ | ||
tidy code | ||
write README / test externally (global and local) |
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
69698
17
183
5