Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gocover/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Go Coverage with Badge",
"id": "gocover",
"version": "1.0.2",
"version": "1.0.3",
"description": "a gocover command to run Go unit tests with coverages, updating the README.md with a coverage badge.",
"keywords": [
"go",
Expand Down
3 changes: 2 additions & 1 deletion src/gocover/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ YELLOW="${YELLOW:-50}"
IGNORE_PKGS=()

if [[ -n "${UNCOVERED_PACKAGES:-}" ]]; then
IFS=',' read -r -a IGNORE_PKGS <<< "${UNCOVERED_PACKAGES}"
# documented as space separated, but also accept commas.
IFS=$' \t,' read -r -a IGNORE_PKGS <<< "${UNCOVERED_PACKAGES}"
fi

# Validate installation configuration.
Expand Down
9 changes: 9 additions & 0 deletions test/gocover/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,14 @@
"yellow": "60"
}
}
},
"uncovered-packages": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/go:1": {},
"gocover": {
"uncovered-packages": "example.com/foo/bar example.com/foo/baz"
}
}
}
}
53 changes: 53 additions & 0 deletions test/gocover/uncovered-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash
set -e

source dev-container-features-test-lib

go mod init example.com/foo

mkdir -p bar baz

cat >foo.go <<EOF
package foo

func fooed() {
println("Fooed")
}
EOF

cat >bar/bar.go <<EOF
package bar

func Barred() {
println("Barred")
}
EOF

cat >baz/baz.go <<EOF
package baz

func Bazzed() {
println("Bazzed")
}
EOF

cat >foo_test.go <<EOF
package foo

import (
"testing"

_ "example.com/foo/bar"
_ "example.com/foo/baz"
)

func TestFoo(t *testing.T) {
fooed()
}
EOF

touch README.md

check "execute gocover with multiple uncovered packages" bash -c "gocover | tee /dev/tty | grep --color 'badge updated to 100.0%'"

reportResults
Loading