MCPcopy
hub / github.com/commitizen/cz-cli / quickPrompterSetup

Function quickPrompterSetup

test/tests/commit.js:400–427  ·  view source on GitHub ↗

* This is just a helper for testing. NOTE that prompter * prompter is overriden for testing purposes.

(repoConfig, adapterConfig, commitMessage, options = {})

Source from the content-addressed store, hash-verified

398 * prompter is overriden for testing purposes.
399 */
400function quickPrompterSetup (repoConfig, adapterConfig, commitMessage, options = {}) {
401
402 commitizenInit(repoConfig.path, adapterConfig.npmName);
403
404 // NOTE:
405 // In our real code we'd use this here but since we're testing,
406 // we'll provide prompter. We'd normally use:
407 // let prompter = getPrompter(adapterConfig.path);
408 let prompter = function (cz, commit) {
409 commit(commitMessage, options);
410 }
411
412 gitInit(repoConfig.path);
413
414 writeFilesToPath(repoConfig.files, repoConfig.path);
415
416 for (let key in repoConfig.files) {
417 let file = repoConfig.files[key];
418 if (file.add !== false) {
419 gitAddFile(repoConfig.path, file.filename);
420 }
421 }
422
423 // NOTE: In the real world we would not be returning
424 // this we would instead be just making the commented
425 // out getPrompter() call to get user input (above).
426 return prompter;
427}

Callers 1

commit.jsFile · 0.85

Calls 1

writeFilesToPathFunction · 0.85

Tested by

no test coverage detected