Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Script execution does not always show a report summary #4475

@gep13

Description

@gep13

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

5.0.0

Operating system

Windows

Operating system architecture

x64

CI Server

GitHub Actions

What are you seeing?

When you run a script that doesn't have any build issues, you get a nice summary of the output, including what was run, what was skipped, and how long each task took.

However, when you run a script that doesn't run to completion, due to an error occuring, the nice summary is not show, and as a result, it is not immediately clear what task has failed.

What is expected?

Regardless of whether the Cake script is successful, or if it contains an error, I always want to see the report summary, so I can immediately see what was executed, how long it took, what was skipped, etc.

Steps to Reproduce

  1. Run the following script and see the report summary shown
var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
    .WithCriteria(c => HasArgument("rebuild"), "Just because!")
    .Does(() =>
{
    Information("Running Clean Task");
});

Task("Build")
    .IsDependentOn("Clean")
    .Does(() =>
{
	//Information("Running build task");
});

Task("Test")
    .IsDependentOn("Build")
    .Does(() =>
{
    Information("Running Test Task");
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);
  1. Run the following script and see the report summary not being shown
var target = Argument("target", "Test");
var configuration = Argument("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////

Task("Clean")
    .WithCriteria(c => HasArgument("rebuild"), "Just because!")
    .Does(() =>
{
    Information("Running Clean Task");
});

Task("Build")
    .IsDependentOn("Clean")
    .Does(() =>
{
	//Information("Running build task");
});

Task("Test")
    .IsDependentOn("Build")
    .Does(() =>
{
    throw new Exception("boom");
});

//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(target);

Output log

NOTE: The following scripts outputs were created using the following setting in the cake.config file:

UseSpectreConsoleForConsoleOutput=true

When running the first script:

==================================================================================================
 Build
==================================================================================================

==================================================================================================
 Test
==================================================================================================
Running Test Task

  Task                      Duration                                Skip Reason
────────────────────────────────────────────────────────────────────────────────────────────────────
  Clean                     Skipped                                 Just because!
  Build                     00:00:00.0535861
  Test                      00:00:00.0024934
────────────────────────────────────────────────────────────────────────────────────────────────────
  Total:                    00:00:00.0560795

And the screenshot version:

Image

When running the second script:

==================================================================================================
 Build
==================================================================================================

==================================================================================================
 Test
==================================================================================================
An error occurred when executing task 'Test'.
Error: boom`

And then the screenshot version:

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions