Repository: semantic-release/semantic-release (js)

Issue:
Discrepancies between options passed to JS and CLI 
## Current behavior

There are discrepancies between passing options to the CLI and  the JavaScript interfaces including 
- option [`ci`](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#ci) has no effect in JS, but `noCi` works
- option [`debug`](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#debug) has no effect when using JS

## Expected behavior

Options should be passed with same name and have the same effect regardless if passed to the JavaScript or CLI interface. Alternatively the differences should be noted in the documentation.

## Environment

- **semantic-release** version: 15.12.4


Pull request:
 fix: allow to set `ci` option via API and config file
Fix #1019

Patch:
diff --git a/cli.js b/cli.js
index 1ef5f5b..9d7e03a 100755
--- a/cli.js
+++ b/cli.js
@@ -47,11 +47,6 @@ Usage:
       return 0;
     }
 
-    // Set the `noCi` options as yargs sets the `ci` options instead (because arg starts with `--no`)
-    if (opts.ci === false) {
-      opts.noCi = true;
-    }
-
     if (opts.debug) {
       // Debug must be enabled before other requires in order to work
       require('debug').enable('semantic-release:*');
diff --git a/docs/usage/configuration.md b/docs/usage/configuration.md
index 12e4d0e..8a6da18 100644
--- a/docs/usage/configuration.md
+++ b/docs/usage/configuration.md
@@ -133,6 +133,8 @@ CLI argument: `--debug`
 
 Output debugging information. This can also be enabled by setting the `DEBUG` environment variable to `semantic-release:*`.
 
+**Note**: The `debug` is used only supported via CLI argument. To enable debug mode from the [JS API](../developer-guide/js-api.md#javascript-api) use `require('debug').enable('semantic-release:*')`.
+
 ## Git environment variables
 
 | Variable              | Description                                                                                                                                                                                                                    | Default                              |
diff --git a/lib/get-config.js b/lib/get-config.js
index aaa76b7..9cf34e0 100644
--- a/lib/get-config.js
+++ b/lib/get-config.js
@@ -27,6 +27,9 @@ module.exports = async (context, opts) => {
 
   // Merge config file options and CLI/API options
   let options = {...config, ...opts};
+  if (options.ci === false) {
+    options.noCi = true;
+  }
   const pluginsPath = {};
   let extendPaths;
   ({extends: extendPaths, ...options} = options);


Test patch:
diff --git a/test/cli.test.js b/test/cli.test.js
index bad7efa..edc7244 100644
--- a/test/cli.test.js
+++ b/test/cli.test.js
@@ -163,18 +163,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'];
diff --git a/test/get-config.test.js b/test/get-config.test.js
index 2fb13a7..568b587 100644
--- a/test/get-config.test.js
+++ b/test/get-config.test.js
@@ -67,6 +67,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();