Skip to content

Commit cd7759a

Browse files
authored
add askedQuestions
1 parent f3b7e41 commit cd7759a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/run-context.ts

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export class RunContextBase<GeneratorType extends BaseGenerator = DefaultGenerat
8383
private options: Partial<Omit<GetGeneratorOptions<GeneratorType>, 'env' | 'namespace' | 'resolved'>> = {};
8484
private answers?: any;
8585
private readonly adapterOptions?: Omit<TestAdapterOptions, 'mockedAnswers'> = {};
86+
private readonly askedQuestions: { name: string; answer: any }[] = [];
8687
private keepFsState?: boolean;
8788

8889
private readonly onGeneratorCallbacks: Array<(this: this, generator: GeneratorType) => any> = [];
@@ -664,6 +665,11 @@ export class RunContextBase<GeneratorType extends BaseGenerator = DefaultGenerat
664665
async build(): Promise<void> {
665666
await this.prepare();
666667

668+
const promptCallback = (answer, opts) => {
669+
const { question } = opts;
670+
this.askedQuestions.push({ name: question.name, answer });
671+
return this.adapterOptions.callback ? this.adapterOptions.callback(answer, opts) : answer;
672+
});
667673
const testEnv = await this.helpers.createTestEnv(this.envOptions.createEnv, {
668674
cwd: this.settings.forwardCwd ? this.targetDirectory : undefined,
669675
sharedFs: this.memFs,

0 commit comments

Comments
 (0)