run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
try {
// Parse command line arguments
final testConfig = _parseTestConfiguration();
final argMorphemeYaml = argResults.getOptionMorphemeYaml();
// Validate morpheme.yaml configuration
YamlHelper.validateMorphemeYaml(argMorphemeYaml);
final morphemeConfig = YamlHelper.loadFileYaml(argMorphemeYaml);
printMessage('🧠 Preparing test environment...');
// Generate bundle test files based on test scope
await _generateBundleTestFiles(testConfig);
// Execute tests based on configuration
await _executeTests(testConfig, morphemeConfig);
// Handle coverage data if enabled
if (testConfig.isCoverage) {
_handleCoverageData(testConfig);
}
printMessage('✨ Test execution completed successfully!');
StatusHelper.success('morpheme test');
} on TestDependencyError catch (e) {
StatusHelper.failed('Test dependency validation failed');
printMessage('');
printMessage('❌ ${e.message}');
printMessage('');
printMessage('🔧 Resolution steps:');
for (final step in e.resolutionSteps) {
printMessage(' • $step');
}
printMessage('');
} catch (e) {
StatusHelper.failed('Test execution failed: $e');
}
}