aboutsummaryrefslogtreecommitdiff
path: root/src/Commands/TestCommand.cs
blob: d64fe64acab51103868ccebc5010604c5b306b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Threading.Tasks;

using Typin.Console;
using Typin.Attributes;

using VNLib.Tools.Build.Executor.Model;
using VNLib.Tools.Build.Executor.Constants;

namespace VNLib.Tools.Build.Executor.Commands
{
    [Command("test", Description = "Executes tests steps within the pipline for all loaded modules")]
    public sealed class TestCommand(BuildPipeline pipeline, ConfigManager cfg) : BaseCommand(pipeline, cfg)
    {
        private readonly BuildPipeline _pipeline = pipeline;

        [CommandOption("--no-fail", Description = "Exit testing on the first test failure")]
        public bool FailOnTestFail { get; set; } = true;

        public override async ValueTask ExecStepsAsync(IConsole console)
        {
            console.Output.WriteLine("Begining test step");

            await _pipeline.ExecuteTestsAsync(FailOnTestFail);

            console.WithForegroundColor(ConsoleColor.Green, o => o.Output.WriteLine("Pipeline tests compled"));
        }

        public override IFeedManager[] Feeds => [];
    }
}