In Yeoman tests, which helpers are used to supply answers and options to a generator?

Prepare for the Yeoman (YN) Test. Use flashcards and multiple-choice questions, all with hints and explanations, to get ready for your upcoming exam. Enhance your learning experience!

Multiple Choice

In Yeoman tests, which helpers are used to supply answers and options to a generator?

Explanation:
In Yeoman tests, you drive the generator as if a user were answering questions and passing command-line flags. The way to do this is to supply answers to the generator’s prompts and to pass options just like you would on the command line. The correct pair is withPrompts for providing answers to prompts, and withOptions for supplying CLI options. Using withPrompts lets you specify exact responses to each question the generator asks, matching the prompt names defined in the generator. Using withOptions lets you set flags such as --skip-install or other supported options, ensuring the test runs deterministically. For example, in a test you might write: run(...).withPrompts({ projectName: 'MyApp', author: 'Me' }).withOptions({ 'skip-install': true }); The other option names shown aren’t part of the standard Yeoman test API, so they wouldn’t apply.

In Yeoman tests, you drive the generator as if a user were answering questions and passing command-line flags. The way to do this is to supply answers to the generator’s prompts and to pass options just like you would on the command line. The correct pair is withPrompts for providing answers to prompts, and withOptions for supplying CLI options. Using withPrompts lets you specify exact responses to each question the generator asks, matching the prompt names defined in the generator. Using withOptions lets you set flags such as --skip-install or other supported options, ensuring the test runs deterministically. For example, in a test you might write: run(...).withPrompts({ projectName: 'MyApp', author: 'Me' }).withOptions({ 'skip-install': true }); The other option names shown aren’t part of the standard Yeoman test API, so they wouldn’t apply.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy