diff --git a/src/collect/parse-commit-messages/index.ts b/src/collect/parse-commit-messages/index.ts index 89493c2..8e1386b 100644 --- a/src/collect/parse-commit-messages/index.ts +++ b/src/collect/parse-commit-messages/index.ts @@ -53,8 +53,7 @@ export const parseCommitMessages: Module = (env: Env) => { )} major / ${yellow(counterMinor)} minor / ${green(counterPatch)} patch` ); } else { - log('No relevant commits found, stopping the script'); - process.exit(0); + log('No relevant commits found'); } return { ...env, commitMessages } as Env; diff --git a/src/collect/parse-commit-messages/spec/index.spec.ts b/src/collect/parse-commit-messages/spec/index.spec.ts index 412ef8f..c6413d5 100644 --- a/src/collect/parse-commit-messages/spec/index.spec.ts +++ b/src/collect/parse-commit-messages/spec/index.spec.ts @@ -47,17 +47,11 @@ jest.mock('../add-level', () => ({ addLevel: mockAddLevel })); describe('parse-commit-messages', () => { let parseCommitMessages: Module; - let mockProcessExit: jest.SpyInstance; beforeAll(() => { - mockProcessExit = jest.spyOn(process, 'exit').mockImplementation(); parseCommitMessages = require('../index').parseCommitMessages; }); - afterAll(() => { - mockProcessExit.mockRestore(); - }); - test('creates "parse commit messages" logger', () => { expect(mockLogger).toHaveBeenCalledTimes(1); expect(mockLogger).toHaveBeenCalledWith('parse commit messages'); @@ -133,15 +127,8 @@ describe('parse-commit-messages', () => { }); if (major + minor + patch === 0) { - test('exits the script with no error', () => { - expect(mockProcessExit).toHaveBeenCalledTimes(1); - expect(mockProcessExit).toHaveBeenCalledWith(0); - }); - - test('exits the script with no error', () => { - expect(mockLog).toHaveBeenLastCalledWith( - 'No relevant commits found, stopping the script' - ); + test('add logs', () => { + expect(mockLog).toHaveBeenLastCalledWith('No relevant commits found'); }); } else { test(`logs ${major} major, ${minor} minor and ${patch} patch commits`, () => {