fix: allow to set ci option via API and config file

This commit is contained in:
Pierre Vanduynslager
2018-12-11 21:18:39 -05:00
parent 635406c4c8
commit 2faff2637f
4 changed files with 15 additions and 17 deletions
-12
View File
@@ -164,18 +164,6 @@ test.serial('Do not set properties in option for which arg is not in command lin
t.false('e' in run.args[0][0]);
});
test.serial('Set "noCi" options to "true" with "--no-ci"', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--no-ci'];
const cli = requireNoCache('../cli', {'.': run, process: {...process, argv}});
const exitCode = await cli();
t.is(run.args[0][0].noCi, true);
t.is(exitCode, 0);
});
test.serial('Display help', async t => {
const run = stub().resolves(true);
const argv = ['', '', '--help'];
+12
View File
@@ -90,6 +90,18 @@ test('Default values, reading repositoryUrl (http url) from package.json if not
t.is(result.tagFormat, `v\${version}`);
});
test('Convert "ci" option to "noCi"', async t => {
const pkg = {repository: 'https://host.null/owner/module.git', release: {ci: false}};
// Create a git repository, set the current working directory at the root of the repo
const {cwd} = await gitRepo();
// Create package.json in repository root
await outputJson(path.resolve(cwd, 'package.json'), pkg);
const {options: result} = await t.context.getConfig({cwd});
t.is(result.noCi, true);
});
test('Read options from package.json', async t => {
// Create a git repository, set the current working directory at the root of the repo
const {cwd} = await gitRepo();