1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
9 | return new (P || (P = Promise))(function (resolve, reject) {
|
10 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
11 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
12 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
13 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
14 | });
|
15 | };
|
16 | Object.defineProperty(exports, "__esModule", { value: true });
|
17 | const index_1 = require("./index");
|
18 | function mockPrompts(template, promptValues = {}, config = {}) {
|
19 | return __awaiter(this, void 0, void 0, function* () {
|
20 | const em = new index_1.Edam({ userc: false, yes: true, storePrompts: false });
|
21 |
|
22 | if (typeof config === 'string') {
|
23 | config = { output: config };
|
24 | }
|
25 | Object.assign(em.config, config);
|
26 | em.once('prompt:after', variables => {
|
27 | variables.assign(promptValues);
|
28 | });
|
29 | return yield em.process(template);
|
30 | });
|
31 | }
|
32 | exports.default = mockPrompts;
|