Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: commitizen/cz-cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.0
Choose a base ref
...
head repository: commitizen/cz-cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.1.1
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Apr 19, 2019

  1. fix(cli): allow argv to be overridden in bootstrap (#621)

    A consumer's CLI has extra arguments, allowing argv to be overridden without mutating the process.argv array directly would be useful.
    fastfrwrd authored and jimthedev committed Apr 19, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    renovate-bot Mend Renovate
    Copy the full SHA
    f7982d3 View commit details
Showing with 11 additions and 4 deletions.
  1. +2 −2 src/cli/commitizen.js
  2. +2 −2 src/cli/git-cz.js
  3. +7 −0 test/tests/cli.js
4 changes: 2 additions & 2 deletions src/cli/commitizen.js
Original file line number Diff line number Diff line change
@@ -12,10 +12,10 @@ export {
* This is the main cli entry point.
* environment may be used for debugging.
*/
function bootstrap (environment = {}) {
function bootstrap (environment = {}, argv = process.argv) {

// Get cli args
let rawGitArgs = process.argv.slice(2, process.argv.length);
let rawGitArgs = argv.slice(2, argv.length);

// Parse the args
let parsedArgs = parse(rawGitArgs);
4 changes: 2 additions & 2 deletions src/cli/git-cz.js
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ export {
* This is the main cli entry point.
* environment may be used for debugging.
*/
function bootstrap (environment = {}) {
function bootstrap (environment = {}, argv = process.argv) {

// Get cli args
let rawGitArgs = process.argv.slice(2, process.argv.length);
let rawGitArgs = argv.slice(2, argv.length);

let adapterConfig = environment.config || configLoader.load();

7 changes: 7 additions & 0 deletions test/tests/cli.js
Original file line number Diff line number Diff line change
@@ -57,5 +57,12 @@ describe('git-cz', () => {
});
});
});

describe('when argv is overridden', () => {
it('uses the overridden argv', () => {
bootstrap({}, ['node', 'git-cz', 'index.js']);
expect(fakeStrategies.git.args[0][0][0]).to.equal('index.js');
});
})
});
});