From 17a430ff1ae5012da9fdb76fcb025b339e39167f Mon Sep 17 00:00:00 2001 From: Kai Wissler Date: Fri, 21 Aug 2020 16:16:36 +0200 Subject: [PATCH] feat: make types config optional --- questions.js | 6 +++++- spec/questionsSpec.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/questions.js b/questions.js index b0f0fb6..4fc7e3d 100644 --- a/questions.js +++ b/questions.js @@ -71,7 +71,11 @@ module.exports = { type: 'list', name: 'type', message: messages.type, - choices: config.types, + choices() { + let types = []; + types = types.concat(config.types); + return types; + }, }, { type: 'list', diff --git a/spec/questionsSpec.js b/spec/questionsSpec.js index 2b1b5b9..620664d 100644 --- a/spec/questionsSpec.js +++ b/spec/questionsSpec.js @@ -34,7 +34,7 @@ describe('cz-customizable', () => { // question 1 - TYPE expect(getQuestion(1).name).toEqual('type'); expect(getQuestion(1).type).toEqual('list'); - expect(getQuestion(1).choices[0]).toEqual({ + expect(getQuestion(1).choices({})[0]).toEqual({ value: 'feat', name: 'feat: my feat', });