Skip to content

pub run build_runner test returns exit code 0 when tests fail or aren't run #874

Closed
@chalin

Description

@chalin

Two issues are being reported here.

(1) When tests fail, I'd expect the shell exit code to be nonzero as opposed to (notice the echo $? at the end of the command):

toh-0 > pub run build_runner test ...; echo $?
[INFO] ensureBuildScript: Generating build script completed, took 332ms
[INFO] BuildDefinition: Reading cached asset graph completed, took 303ms
[INFO] BuildDefinition: Checking for updates since last build completed, took 441ms
[INFO] Build: Running build completed, took 8.0s
[INFO] Build: Caching finalized dependency graph completed, took 103ms
[INFO] CreateOutputDir: Deleting existing output dir `build` completed, took 503ms
[INFO] CreateOutputDir: Creating merged output dir `build` completed, took 1.9s
[INFO] Build: Succeeded after 10.5s with 19 outputs

Running tests...

00:02 +0 -1: test/app_test.dart: Default greeting [E]                                                                                                                                                  
  Expected: 'Hello Angular2'
    Actual: 'Hello Angular'
     Which: is different. Both strings start the same, but the actual value is missing the following trailing characters: 2
  
  
00:02 +2 -1: Some tests failed.                                                                                                                                                                        
0 # <-- tests failed but the exit code is still 0

(2) Also, looking at this Travis log, you'll notice that the test run fails because

UnexpectedExistingOutputsException: Either you opted not to delete existing files, or you are not running in interactive mode and did not specify `deleteFilesByDefault` as `true`.

and yet the exit code returned was still 0 (I also confirmed this behavior locally). If tests didn't run successfully, as in this case, then the exit code should be nonzero.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions