Skip to content

Commit 949579c

Browse files
committed
test: add case for signed-off-by with --amend
1 parent 8a44247 commit 949579c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
rules: {
3+
'signed-off-by': [2, 'always', 'Signed-off-by']
4+
}
5+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"scripts": {},
3+
"devDependencies": {
4+
"husky": "0.14.3"
5+
}
6+
}

@commitlint/cli/src/cli.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ test('should pick up config from inside git repo with precedence and fail accord
168168
t.is(actual.code, 1);
169169
});
170170

171+
test('should handle --amend with signoff', async () => {
172+
const cwd = await git.bootstrap('fixtures/signoff');
173+
await writePkg({scripts: {commitmsg: `${bin} -e`}}, {cwd});
174+
175+
await execa('npm', ['install'], {cwd});
176+
await execa('git', ['add', 'package.json'], {cwd});
177+
await execa(
178+
'git',
179+
['commit', '-m', '"test: this should work"', '--signoff'],
180+
{cwd}
181+
);
182+
await execa('git', ['commit', '--amend', '--no-edit'], {cwd});
183+
});
184+
171185
async function writePkg(payload, options) {
172186
const pkgPath = path.join(options.cwd, 'package.json');
173187
const pkg = JSON.parse(await sander.readFile(pkgPath));

0 commit comments

Comments
 (0)