From c530a6767731bcec43c8db5ffab4986e424fa0b6 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Mon, 18 Mar 2024 14:19:21 -0700 Subject: [PATCH 1/2] Use stderr to output test runner logs --- go.mod | 4 ++-- go.sum | 5 ++--- internal/test/test.go | 4 ++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 9e553ad7b..7d65ce5f3 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,8 @@ require ( github.com/manifoldco/promptui v0.9.0 github.com/onflow/cadence v0.42.9 github.com/onflow/cadence-tools/languageserver v0.33.3 - github.com/onflow/cadence-tools/test v0.14.5 + github.com/onflow/cadence-tools/lint v0.14.1 + github.com/onflow/cadence-tools/test v0.14.6 github.com/onflow/fcl-dev-wallet v0.7.4 github.com/onflow/flixkit-go v1.1.2 github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f @@ -175,7 +176,6 @@ require ( github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.6.0 // indirect - github.com/onflow/cadence-tools/lint v0.14.1 // indirect github.com/onflow/crypto v0.25.0 // indirect github.com/onflow/flow-cli/flowkit v1.11.0 // indirect github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20231016154253-a00dbf7c061f // indirect diff --git a/go.sum b/go.sum index ad79c0170..1ae2421b8 100644 --- a/go.sum +++ b/go.sum @@ -891,8 +891,8 @@ github.com/onflow/cadence-tools/languageserver v0.33.3 h1:o6f2kPxsgSruH+HT8CakcZ github.com/onflow/cadence-tools/languageserver v0.33.3/go.mod h1:rUy3zxWWZl+KYAyzhAcnrYNI8ZDKI242RFK8Q9w+90M= github.com/onflow/cadence-tools/lint v0.14.1 h1:Qkw8+q+ALfB62W7KWHMFh+90gTfJ+NoFulYETMCTkcI= github.com/onflow/cadence-tools/lint v0.14.1/go.mod h1:w1xfiiPpZ35v/F+2+MF/Rily7LcIgE0dm/FMW1vQkpc= -github.com/onflow/cadence-tools/test v0.14.5 h1:u1kYkotKdwKEf9c3h65mI3VMevBkHY+7WsOiOLamjzU= -github.com/onflow/cadence-tools/test v0.14.5/go.mod h1:ix09Bb3GQ/fZMNpSR8E+vSFItGF54fzP9gFxU7AsOIw= +github.com/onflow/cadence-tools/test v0.14.6 h1:UQ9oUndf1uDlwGUhA4ks0AHM6fRLqs153JO36eVFnFY= +github.com/onflow/cadence-tools/test v0.14.6/go.mod h1:ix09Bb3GQ/fZMNpSR8E+vSFItGF54fzP9gFxU7AsOIw= github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg= github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= github.com/onflow/fcl-dev-wallet v0.7.4 h1:vI6t3U0AO88R/Iitn5KsnniSpbN9Lqsqwvi9EJT4C0k= @@ -1038,7 +1038,6 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qq github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= diff --git a/internal/test/test.go b/internal/test/test.go index 0d32560a4..9c2bd256b 100644 --- a/internal/test/test.go +++ b/internal/test/test.go @@ -30,6 +30,7 @@ import ( cdcTests "github.com/onflow/cadence-tools/test" "github.com/onflow/cadence/runtime" "github.com/onflow/cadence/runtime/common" + "github.com/rs/zerolog" "github.com/spf13/cobra" "github.com/onflow/flowkit" @@ -148,6 +149,9 @@ func testCode( ) (*result, error) { runner := cdcTests.NewTestRunner() + logger := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() + runner = runner.WithLogger(logger) + var coverageReport *runtime.CoverageReport if flags.Cover { coverageReport = state.CreateCoverageReport("testing") From 18023b464c5ebcb38179705da13b69b3b916acd5 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Mon, 18 Mar 2024 14:32:32 -0700 Subject: [PATCH 2/2] address feedback --- internal/test/test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/test/test.go b/internal/test/test.go index 9c2bd256b..6b219cf75 100644 --- a/internal/test/test.go +++ b/internal/test/test.go @@ -147,10 +147,8 @@ func testCode( state *flowkit.State, flags flagsTests, ) (*result, error) { - runner := cdcTests.NewTestRunner() - logger := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() - runner = runner.WithLogger(logger) + runner := cdcTests.NewTestRunner().WithLogger(logger) var coverageReport *runtime.CoverageReport if flags.Cover {