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

cz-jira-smart-commit

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cz-jira-smart-commit - npm Package Compare versions

Comparing version 1.0.3 to 2.0.1

.travis.yml

37

index.js

@@ -0,1 +1,3 @@

var inquirer = require('inquirer')
// This can be any kind of SystemJS compatible module.

@@ -26,5 +28,17 @@ // We use Commonjs here, but ES6 or AMD would do just

// collection library if you prefer.
cz.prompt([
inquirer.prompt([
{
type: 'input',
name: 'message',
message: 'GitHub commit message (required):\n',
validate: function(input) {
if (!input) {
return 'empty commit message';
} else {
return true;
}
}
},
{
type: 'input',
name: 'issues',

@@ -42,7 +56,2 @@ message: 'Jira Issue ID(s) (required):\n',

type: 'input',
name: 'time',
message: 'Time spent (i.e. 3h 15m) (optional):\n'
},
{
type: 'input',
name: 'workflow',

@@ -60,10 +69,10 @@ message: 'Workflow command (testing, closed, etc.) (optional):\n',

type: 'input',
name: 'time',
message: 'Time spent (i.e. 3h 15m) (optional):\n'
},
{
type: 'input',
name: 'comment',
message: 'Jira comment (optional):\n'
},
{
type: 'input',
name: 'message',
message: 'Anything else that would be helpful to note (not included in the Jira issue) (optional):\n'
}
], commitAnswers);

@@ -73,7 +82,7 @@

commit(filter([
answers.message,
answers.issues,
answers.workflow ? '#' + answers.workflow : undefined,
answers.time ? '#time ' + answers.time : undefined,
answers.comment ? '#comment ' + answers.comment : undefined,
answers.time ? '#time ' + answers.time : undefined,
answers.workflow ? '#' + answers.workflow : undefined,
answers.message ? '\n' + answers.message : undefined
]).join(' '));

@@ -80,0 +89,0 @@ }

import sinon from 'sinon';
import chai from 'chai';
import sinonChai from 'sinon-chai';
import {prompter} from './index';
import proxyquire from 'proxyquire';

@@ -10,63 +10,54 @@ const {expect} = chai;

describe(`prompter`, () => {
let cz, commit;
beforeEach(() => {
cz = {prompt: sinon.spy()};
let inquirer, commit, prompter, commitAnswers;
before(() => {
commit = sinon.spy();
inquirer = {prompt: sinon.spy()};
prompter = proxyquire('./', {inquirer}).prompter;
});
it(`call cz.prompt`, () => {
prompter(cz);
expect(cz.prompt).to.have.been.calledWith(sinon.match.array, sinon.match.func);
beforeEach(() => {
prompter(null, commit);
commitAnswers = inquirer.prompt.getCall(0).args[1];
});
describe(`commitAnswers`, () => {
let commitAnswers;
beforeEach(() => {
prompter(cz, commit);
commitAnswers = cz.prompt.getCall(0).args[1];
});
it(`should call commit with the proper message`, () => {
const message = 'sample commit message';
const issues = 'CZ-234 CZ-235';
const workflow = 'closed';
const time = '3y 2w 7d 8h 30m';
const comment = 'This took waaaaay too long';
commitAnswers({message, issues, workflow, time, comment});
expect(commit).to.have.been.calledWith([
message,
issues,
`#${workflow}`,
`#time ${time}`,
`#comment ${comment}`
].join(' '));
});
it(`should call commit with the proper message`, () => {
['workflow', 'time', 'comment'].forEach((item) => {
it(`should just leave off ${item} if it's not specified`, () => {
const message = 'sample commit message';
const issues = 'CZ-234 CZ-235';
const workflow = 'closed';
const time = '3y 2w 7d 8h 30m';
const workflow = 'closed';
const comment = 'This took waaaaay too long';
const message = 'It would not have been so bad except I got distracted...';
commitAnswers({issues, time, workflow, comment, message});
expect(commit).to.have.been.calledWith([
const answers = {message, issues, workflow, time, comment};
delete answers[item];
commitAnswers(answers);
expect(commit).to.have.been.calledWith(filter([
message,
issues,
`#comment ${comment}`,
`#time ${time}`,
`#${workflow}`,
'\n' + message
].join(' '));
item !== 'workflow' ? `#${workflow}` : undefined,
item !== 'time' ? `#time ${time}` : undefined,
item !== 'comment' ? `#comment ${comment}` : undefined
]).join(' '));
});
['comment', 'time', 'workflow', 'message'].forEach((item) => {
it(`should just leave off ${item} if it's not specified`, () => {
const issues = 'CZ-234 CZ-235';
const time = '3y 2w 7d 8h 30m';
const workflow = 'closed';
const comment = 'This took waaaaay too long';
const message = 'It would not have been so bad except I got distracted...';
const answers = {issues, time, workflow, comment, message};
delete answers[item];
commitAnswers(answers);
expect(commit).to.have.been.calledWith(filter([
issues,
item !== 'comment' ? `#comment ${comment}` : undefined,
item !== 'time' ? `#time ${time}` : undefined,
item !== 'workflow' ? `#${workflow}` : undefined,
item !== 'message' ? '\n' + message : undefined
]).join(' '));
});
})
});
});
function filter(array) {
return array.filter(function(item) {
return !!item;
});
return array.filter(Boolean);
}
{
"name": "cz-jira-smart-commit",
"version": "1.0.3",
"version": "2.0.1",
"description": "A commitizen adapter for Jira smart commits",

@@ -24,2 +24,5 @@ "main": "index.js",

"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
"contributors": [
"Jane Kim <jane@janekim.me> (http://janekim.me)"
],
"license": "MIT",

@@ -35,6 +38,10 @@ "bugs": {

"nodemon": "1.4.0",
"proxyquire": "^1.7.10",
"sinon": "1.15.4",
"sinon-chai": "2.8.0",
"with-package": "0.2.0"
},
"dependencies": {
"inquirer": "^1.1.3"
}
}
# cz-jira-smart-commit
A commitizen adapter for [Jira smart commits](https://confluence.atlassian.com/display/FISHEYE/Using+smart+commits)
A commitizen adapter for [Jira smart commits](https://confluence.atlassian.com/display/FISHEYE/Using+smart+commits).

@@ -25,10 +25,16 @@ ![Screenshot](other/screenshot.png)

or use commitizen to init
```
commitizen init cz-jira-smart-commit
```
### Day to day work
Instead of `git commit -m 'Your message'`, you type: `git gz` with this adapter and it prompts you for:
Instead of `git commit -m 'Your message'`, you type: `git cz` with this adapter and it prompts you for:
- commit message
- Jira Issue Key(s)
- Workflow command
- Time Spent
- Workflow command
- Comment

@@ -35,0 +41,0 @@

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