Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
rules: {
'subject-empty': [2, 'never'],
'type-empty': [2, 'never'],
'type-enum': [2, 'always', [
'test'
]]
}
};
10 changes: 10 additions & 0 deletions @commitlint/cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ test('should produce last commit and success output with --verbose flag', async
expect(actual.stderr).toEqual('');
});

test('regression test for running with --last flag', async () => {
const cwd = await gitBootstrap('fixtures/last-flag-regression');
await execa('git', ['add', 'commitlint.config.js'], {cwd});
await execa('git', ['commit', '-m', '"test: this should work"'], {cwd});
const actual = await cli(['--last', '--verbose'], {cwd})();
expect(actual.stdout).toContain('0 problems, 0 warnings');
expect(actual.stdout).toContain('test: this should work');
expect(actual.stderr).toEqual('');
});

test('should produce no output with --quiet flag', async () => {
const cwd = await gitBootstrap('fixtures/default');
const actual = await cli(['--quiet'], {cwd})('foo: bar');
Expand Down
10 changes: 7 additions & 3 deletions @commitlint/read/src/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ export default async function getCommitMessages(
}

if (last) {
const executeGitCommand = await execa('git', [
const gitCommandResult = await execa('git', [
'log',
'-1',
'--pretty=format:"%B"',
'--pretty=format:%B',
]);
return [executeGitCommand.stdout];
let output = gitCommandResult.stdout;
// strip output of extra quotation marks ("")
if (output[0] == '"' && output[output.length - 1] == '"')
output = output.slice(1, -1);
return [output];
}

let gitOptions: GitOptions = {from, to};
Expand Down