import type { TestRunner } from '@adonisjs/assembler'; import type { CommandOptions } from '../types/ace.ts'; import { BaseCommand } from '../modules/ace/main.ts'; /** * Command to run application tests using the Japa test runner. * Supports filtering tests by suites, files, tags, groups, and individual tests. * Can run in watch mode to automatically re-run tests when files change. * * @example * ``` * ace test * ace test unit integration * ace test --watch * ace test --files=user.spec.ts * ace test --tags=slow --groups="User tests" * ace test --reporters=spec,dot * ace test --timeout=5000 --retries=2 * ``` */ export default class Test extends BaseCommand { #private; /** * The command name */ static commandName: string; /** * The command description */ static description: string; /** * Command options configuration. * Allows unknown flags to be passed to Japa and keeps the process alive. */ static options: CommandOptions; /** * The test runner instance from the assembler package */ testsRunner: TestRunner; /** * Test suite names to run. When provided, only tests from the specified suites will be executed */ suites?: string[]; /** * Filter tests by filename patterns */ files?: string[]; /** * Filter tests by tags */ tags?: string[]; /** * Filter tests by parent group title */ groups?: string[]; /** * Filter tests by test title */ tests?: string[]; /** * Specify one or more test reporters to use for output formatting */ reporters?: string[]; /** * Enable watch mode to automatically re-run tests when files change */ watch?: boolean; /** * Use polling instead of native filesystem events to detect file changes */ poll?: boolean; /** * Default timeout in milliseconds for all tests */ timeout?: number; /** * Default number of retries for failed tests */ retries?: number; /** * Execute only tests that failed during the last run */ failed?: boolean; /** * Clear the terminal for new logs after file change in watch mode */ clear?: boolean; /** * Execute the test command. Sets up the test runner with all configured options * and filters, then runs tests either once or in watch mode. Handles missing * dependencies and properly configures the test environment. */ run(): Promise; }