diff --git a/docs/images/wechat.png b/docs/images/wechat.png index 6485ae2..c839152 100644 Binary files a/docs/images/wechat.png and b/docs/images/wechat.png differ diff --git a/pkg/cover/client_test.go b/pkg/cover/client_test.go index f858872..4313dfe 100644 --- a/pkg/cover/client_test.go +++ b/pkg/cover/client_test.go @@ -127,6 +127,18 @@ func TestClientAction(t *testing.T) { param: ProfileParam{CoverFilePatterns: []string{"b.go$"}}, expected: "b/b.go", }, + { + name: "valid test with skipfile flag provided", + service: ServiceUnderTest{Name: "serviceOK", Address: profileSuccessMockSvr.URL}, + param: ProfileParam{SkipFilePatterns: []string{"b.go$"}}, + expected: "main.go", + }, + { + name: "valid test with both skipfile and coverfile flags provided", + service: ServiceUnderTest{Name: "serviceOK", Address: profileSuccessMockSvr.URL}, + param: ProfileParam{SkipFilePatterns: []string{"main.go"}, CoverFilePatterns: []string{".go$"}}, + expected: "b.go", + }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { diff --git a/tests/profile.bats b/tests/profile.bats index 92c8f26..f4a4b7c 100755 --- a/tests/profile.bats +++ b/tests/profile.bats @@ -98,26 +98,6 @@ setup() { kill -9 $SAMPLE_PID } -@test "test goc profile with coverfile and skipfile flags" { - ./simple-project 3>&- & - SAMPLE_PID=$! - sleep 2 - - wait_profile_backend "profile3" & - profile_pid=$! - - run gocc profile --center=http://127.0.0.1:60001 --coverfile="a.go$,b.go$" --skipfile="b.go$" --debug --debugcisyncfile ci-sync.bak; - info $output - [ "$status" -eq 0 ] - [[ "$output" == *"mode: count"* ]] - [[ "$output" == *"a.go"* ]] # contains a.go file - [[ "$output" != *"b.go"* ]] # not contains b.go file - [[ "$output" != *"main.go"* ]] # not contains main.go file - - wait $profile_pid - kill -9 $SAMPLE_PID -} - @test "test goc profile with service flag" { ./simple-project 3>&- & SAMPLE_PID=$! @@ -148,6 +128,26 @@ setup() { [ "$status" -eq 0 ] [[ "$output" == *"mode: count"* ]] + wait $profile_pid + kill -9 $SAMPLE_PID +} + +@test "test goc profile with coverfile and skipfile flags" { + ./simple-project 3>&- & + SAMPLE_PID=$! + sleep 2 + + wait_profile_backend "profile6" & + profile_pid=$! + + run gocc profile --center=http://127.0.0.1:60001 --coverfile="a.go$,b.go$" --skipfile="b.go$" --debug --debugcisyncfile ci-sync.bak; + info $output + [ "$status" -eq 0 ] + [[ "$output" == *"mode: count"* ]] + [[ "$output" == *"a.go"* ]] # contains a.go file + [[ "$output" != *"b.go"* ]] # not contains b.go file + [[ "$output" != *"main.go"* ]] # not contains main.go file + wait $profile_pid kill -9 $SAMPLE_PID } \ No newline at end of file