Skip to content

Commit

Permalink
test: add case for signed-off-by with --amend
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Dec 8, 2017
1 parent 8a44247 commit 949579c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions @commitlint/cli/fixtures/signoff/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
rules: {
'signed-off-by': [2, 'always', 'Signed-off-by']
}
};
6 changes: 6 additions & 0 deletions @commitlint/cli/fixtures/signoff/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scripts": {},
"devDependencies": {
"husky": "0.14.3"
}
}
14 changes: 14 additions & 0 deletions @commitlint/cli/src/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ test('should pick up config from inside git repo with precedence and fail accord
t.is(actual.code, 1);
});

test('should handle --amend with signoff', async () => {
const cwd = await git.bootstrap('fixtures/signoff');
await writePkg({scripts: {commitmsg: `${bin} -e`}}, {cwd});

await execa('npm', ['install'], {cwd});
await execa('git', ['add', 'package.json'], {cwd});
await execa(
'git',
['commit', '-m', '"test: this should work"', '--signoff'],
{cwd}
);
await execa('git', ['commit', '--amend', '--no-edit'], {cwd});
});

async function writePkg(payload, options) {
const pkgPath = path.join(options.cwd, 'package.json');
const pkg = JSON.parse(await sander.readFile(pkgPath));
Expand Down

0 comments on commit 949579c

Please sign in to comment.