Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inquirer): fix inquirer types #1563

Merged
merged 1 commit into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/initializer/StrykerInquirer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface PromptResult {
export class StrykerInquirer {

public async promptPresets(options: Preset[]): Promise<Preset | undefined> {
const choices: inquirer.ChoiceType[] = options.map(_ => _.name);
const choices: inquirer.ChoiceType<string>[] = options.map(_ => _.name);
choices.push(new inquirer.Separator());
choices.push('None/other');
const answers = await inquirer.prompt<{ preset: string }>({
Expand All @@ -24,7 +24,7 @@ export class StrykerInquirer {
}

public async promptTestRunners(options: PromptOption[]): Promise<PromptOption> {
const choices: inquirer.ChoiceType[] = options.map(_ => _.name);
const choices: inquirer.ChoiceType<string>[] = options.map(_ => _.name);
choices.push(new inquirer.Separator());
choices.push(CommandTestRunner.runnerName);
const answers = await inquirer.prompt<{ testRunner: string }>({
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/initializer/presets/ReactPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ReactPreset implements Preset {
}`;

public async createConfig(): Promise<PresetConfiguration> {
const choices: inquirer.ChoiceType[] = ['JSX', 'TSX'];
const choices: inquirer.ChoiceType<string>[] = ['JSX', 'TSX'];
const answers = await inquirer.prompt<{ choice: string }>({
choices,
message: 'Is your project a JSX project or a TSX project?',
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/initializer/presets/VueJsPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export class VueJsPreset implements Preset {
}`;

public async createConfig(): Promise<PresetConfiguration> {
const testRunnerChoices: inquirer.ChoiceType[] = ['karma', 'jest'];
const testRunnerChoices: inquirer.ChoiceType<string>[] = ['karma', 'jest'];
const testRunnerAnswers = await inquirer.prompt<{ testRunner: string }>({
choices: testRunnerChoices,
message: 'Which test runner do you want to use?',
name: 'testRunner',
type: 'list'
});
const scriptChoices: inquirer.ChoiceType[] = ['typescript', 'javascript'];
const scriptChoices: inquirer.ChoiceType<string>[] = ['typescript', 'javascript'];
const scriptAnswers = await inquirer.prompt<{ script: string }>({
choices: scriptChoices,
message: 'Which language does your project use?',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@ describe(StrykerInitializer.name, () => {
});
await sut.initialize();
expect(inquirerPrompt).callCount(7);
const [promptPreset, promptTestRunner, promptTestFramework, promptMutator, promptTranspilers, promptReporters, promptPackageManagers]: inquirer.Question[] = [
const [promptPreset, promptTestRunner, promptTestFramework, promptMutator, promptPackageManagers]: inquirer.ListQuestion<string>[] = [
inquirerPrompt.getCall(0).args[0],
inquirerPrompt.getCall(1).args[0],
inquirerPrompt.getCall(2).args[0],
inquirerPrompt.getCall(3).args[0],
inquirerPrompt.getCall(6).args[0],
];
const [promptTranspilers, promptReporters]: inquirer.CheckboxQuestion<string>[] = [
inquirerPrompt.getCall(4).args[0],
inquirerPrompt.getCall(5).args[0],
inquirerPrompt.getCall(6).args[0],
];
expect(promptPreset.type).to.eq('list');
expect(promptPreset.name).to.eq('preset');
Expand Down Expand Up @@ -196,7 +198,7 @@ describe(StrykerInitializer.name, () => {
});
await sut.initialize();
expect(inquirerPrompt).callCount(2);
const [promptPreset, promptPackageManager]: inquirer.Question[] = [
const [promptPreset, promptPackageManager]: inquirer.ListQuestion<string>[] = [
inquirerPrompt.getCall(0).args[0],
inquirerPrompt.getCall(1).args[0]
];
Expand Down