diff --git a/README.md b/README.md index 6868aaa..d3316af 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Suitable for large teams working with multiple projects with their own commit sc [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![npm monthly downloads](https://img.shields.io/npm/dm/cz-customizable.svg?style=flat-square)](https://www.npmjs.com/package/cz-customizable) +[![bundlephobia](https://badgen.net/bundlephobia/minzip/cz-customizable)](https://bundlephobia.com/package/cz-customizable) You have two ways to use `cz-customizable`. Originally, this project started as a commitizen plugin (Option 1). We introduced the second option to run this `cz-customizable` in standalone mode (Option 2), just like any NodeJS script. It's recommended to use `Option 2` for simplicity. The way you configure is shared between both options. diff --git a/__tests__/questions.test.js b/__tests__/questions.test.js index 98ed5dc..7b51524 100644 --- a/__tests__/questions.test.js +++ b/__tests__/questions.test.js @@ -1,5 +1,3 @@ -/* eslint-disable nada/path-case */ -const fs = require('fs'); const questions = require('../lib/questions.js'); describe('cz-customizable', () => { @@ -10,10 +8,7 @@ describe('cz-customizable', () => { }); const mockedCz = { - // Separator: jasmine.createSpy(), - // Separator: jest.fn().mockReturnValue(null), Separator: jest.fn(), - // Separator: () => '', }; const getQuestion = number => questions.getQuestions(config, mockedCz)[number - 1]; @@ -267,43 +262,4 @@ describe('cz-customizable', () => { }); }); }); - - // TODO: fix tests - describe.skip('commit already prepared', () => { - let existsSync; - let readFileSync; - - beforeEach(() => { - config = {}; - existsSync = spyOn(fs, 'existsSync'); - readFileSync = spyOn(fs, 'readFileSync'); - }); - - it('should ignore if there is no prepared commit file', () => { - existsSync.andReturn(false); - expect(getQuestion(5).default).toEqual(null); - expect(getQuestion(6).default).toEqual(null); - }); - - it('should ignore an empty prepared commit', () => { - existsSync.andReturn(true); - readFileSync.andReturn(''); - expect(getQuestion(5).default).toEqual(null); - expect(getQuestion(6).default).toEqual(null); - }); - - it('should take a single line commit as the subject', () => { - existsSync.andReturn(true); - readFileSync.andReturn('my commit'); - expect(getQuestion(5).default).toEqual('my commit'); - expect(getQuestion(6).default).toEqual(null); - }); - - it('should split multi line commit between the subject and the body', () => { - existsSync.andReturn(true); - readFileSync.andReturn('my commit\nmessage\n\nis on several lines'); - expect(getQuestion(5).default).toEqual('my commit'); - expect(getQuestion(6).default).toEqual(`message|is on several lines`); - }); - }); }); diff --git a/lib/build-commit.js b/lib/build-commit.js index d17d7ff..a82cd70 100644 --- a/lib/build-commit.js +++ b/lib/build-commit.js @@ -9,9 +9,11 @@ const addTicketNumber = (ticketNumber, config) => { if (!ticketNumber) { return ''; } + if (config.ticketNumberPrefix) { return `${config.ticketNumberPrefix + ticketNumber.trim()} `; } + return `${ticketNumber.trim()} `; };