@elsikora/setup-wizard
Version:
Setup Wizard - CLI scaffolding utility
125 lines • 5.5 kB
TypeScript
import type { IModuleService } from "../../infrastructure/interface/module-service.interface";
import type { ICliInterfaceService } from "../interface/cli-interface-service.interface";
import type { ICommandService } from "../interface/command-service.interface";
import type { IConfigService } from "../interface/config-service.interface";
import type { IFileSystemService } from "../interface/file-system-service.interface";
import type { IModuleSetupResult } from "../interface/module-setup-result.interface";
import { PackageJsonService } from "./package-json.service";
/**
* Service for setting up and managing testing configuration.
* Supports multiple testing frameworks through configuration.
*/
export declare class TestingModuleService implements IModuleService {
/** CLI interface service for user interaction */
readonly CLI_INTERFACE_SERVICE: ICliInterfaceService;
/** Command service for executing shell commands */
readonly COMMAND_SERVICE: ICommandService;
/** Configuration service for managing app configuration */
readonly CONFIG_SERVICE: IConfigService;
/** File system service for file operations */
readonly FILE_SYSTEM_SERVICE: IFileSystemService;
/** Service for managing package.json */
readonly PACKAGE_JSON_SERVICE: PackageJsonService;
/** Cached testing configuration */
private config;
/**
* Initializes a new instance of the TestingModuleService.
* @param cliInterfaceService - Service for CLI user interactions
* @param fileSystemService - Service for file system operations
* @param configService - Service for managing app configuration
*/
constructor(cliInterfaceService: ICliInterfaceService, fileSystemService: IFileSystemService, configService: IConfigService);
/**
* Handles existing testing setup.
* Checks for existing configuration files and asks if user wants to remove them.
* @returns Promise resolving to true if setup should proceed, false otherwise
*/
handleExistingSetup(): Promise<boolean>;
/**
* Installs and configures the testing framework.
* Guides the user through setting up testing configuration.
* @returns Promise resolving to the module setup result
*/
install(): Promise<IModuleSetupResult>;
/**
* Determines if the testing framework should be installed.
* Asks the user if they want to set up testing configuration.
* Uses the saved config value as default if it exists.
* @returns Promise resolving to true if the module should be installed, false otherwise
*/
shouldInstall(): Promise<boolean>;
/**
* Creates e2e test configuration file.
* @param framework - The selected testing framework
* @param isTypeScript - Whether the project uses TypeScript
* @param isCoverageEnabled - Whether coverage is enabled
*/
private createEndToEndConfig;
/**
* Creates test directories if they don't exist.
*/
private createTestDirectories;
/**
* Creates unit test configuration file.
* @param framework - The selected testing framework
* @param isTypeScript - Whether the project uses TypeScript
* @param isCoverageEnabled - Whether coverage is enabled
*/
private createUnitConfig;
/**
* Displays a summary of the testing setup results.
* Lists configuration options, generated scripts, and files.
* @param framework - The selected testing framework
* @param isUnitEnabled - Whether unit tests are enabled
* @param isCoverageEnabled - Whether coverage is enabled
* @param isEndToEndEnabled - Whether e2e tests are enabled
*/
private displaySetupSummary;
/**
* Finds existing testing configuration files.
* @returns Promise resolving to an array of file paths for existing configuration files
*/
private findExistingConfigFiles;
/**
* Prompts the user if they want to enable coverage.
* @returns Promise resolving to true if coverage should be enabled
*/
private isCoverageEnabled;
/**
* Prompts the user if they want to enable e2e tests.
* @returns Promise resolving to true if e2e tests should be enabled
*/
private isEndToEndEnabled;
/**
* Checks if the project uses TypeScript by looking for tsconfig.json.
* @returns Promise resolving to true if TypeScript is detected
*/
private isTypeScriptProject;
/**
* Prompts the user if they want to enable unit tests.
* @returns Promise resolving to true if unit tests should be enabled
*/
private isUnitEnabled;
/**
* Prompts the user to select a testing framework.
* @returns Promise resolving to the selected testing framework
*/
private selectTestingFramework;
/**
* Sets up npm scripts for testing.
* Adds scripts for running tests, coverage, and watch mode.
* @param framework - The selected testing framework
* @param isUnitEnabled - Whether to add unit test scripts
* @param isCoverageEnabled - Whether to add coverage script
* @param isEndToEndEnabled - Whether to add e2e test scripts
*/
private setupScripts;
/**
* Sets up testing configuration.
* Collects user input, installs dependencies, creates config files,
* and sets up scripts.
* @returns Promise resolving to an object containing setup parameters
*/
private setupTesting;
}
//# sourceMappingURL=testing-module.service.d.ts.map