1
0
mirror of synced 2026-03-25 15:01:35 +00:00

feat(CLI): don't attempt to commit if user.name/email is not set

This commit is contained in:
Jason Dreyzehner
2018-03-10 15:48:13 -05:00
parent abef54a412
commit 58688fc9d9
3 changed files with 38 additions and 5 deletions

View File

@@ -120,10 +120,29 @@ test('getUserInfo: suppresses errors and returns empty strings', async t => {
});
test('initialCommit: throws generated errors', async t => {
const error = await t.throws(initialCommit(mockErr(1))('deadbeef', 'fail'));
const error = await t.throws(
initialCommit(mockErr(1))('deadbeef', 'fail', 'name', 'bitjson@github.com')
);
t.is(error.code, 1);
});
test("initialCommit: don't attempt to commit if user.name/email is not set", async t => {
// tslint:disable-next-line:no-let
let calls = 0;
const errorIf3 = ((() => {
calls++;
calls === 1 ? t.pass() : calls === 2 ? t.pass() : t.fail();
}) as any) as ExecaStatic;
t.false(
await initialCommit(errorIf3)(
'deadbeef',
'fail',
Placeholders.name,
Placeholders.email
)
);
});
test('install: uses the correct runner', async t => {
const mock = (((runner: Runner) => {
runner === Runner.Yarn ? t.pass() : t.fail();