gofasta test
Wraps go test with the gofasta defaults: race detector on, every package under ./..., output streamed straight to the terminal. Equivalent to go test -race ./... but shorter and consistent with the rest of the gofasta CLI (banner, --json mode, etc.).
gofasta test # all packages, race detector on
gofasta test ./app/services # one package
gofasta test ./app/... # everything under app/
gofasta test ./app/... -- -count=1 # forward extra flags to go testUsage
gofasta test [path...] [flags] [-- go-test-flags]Positional args are package paths passed through to go test. Anything after a literal -- is forwarded verbatim to go test so you can use flags gofasta doesn’t shortcut.
Flags
| Flag | Short | Default | Description |
|---|---|---|---|
--short | -s | false | Skip long-running tests (passes -short to go test). |
--integration | -i | false | Run only Integration-named tests (passes -run Integration). |
--coverage | -c | false | Write coverage profile to coverage.out and print total %. |
--run | -r | (none) | Run only tests matching the regex pattern (-run <pattern>). |
--no-race | false | Skip the race detector (faster, less safe). | |
--verbose | -v | false | Verbose output (passes -v to go test). |
Global flags:
--json— forwards-jsontogo test, producing NDJSON events suitable forgotestsum, GitHub Actions test reporters, or your own pipeline. Suppresses the banner and progress line so stdout is a strict JSON stream.
Examples
Run everything, race detector on (the default):
gofasta testSkip long tests:
gofasta test --shortRun only Integration-prefixed tests:
gofasta test --integrationCoverage profile + total %:
gofasta test --coverage
# → writes coverage.out, prints "coverage: 87.4% of statements"Filter to one test:
gofasta test --run TestUserCreate
gofasta test --run "TestUser.*" # regexSkip the race detector for a faster run:
gofasta test --no-raceScope to one package:
gofasta test ./app/servicesForward extra go test flags after --:
gofasta test ./app/... -- -count=1 -tags=integration -timeout=5mCI: NDJSON output for a test reporter:
gofasta test --json | tee test-output.jsonlHow it works
gofasta test builds a single go test command line:
go test -race ./... [-short] [-integration -run Integration] [-coverprofile=coverage.out] [-run=<pattern>] [-v] [-json] [paths...] [-- extra-go-test-flags]Then runs it with stdout/stderr inherited (so live progress shows up immediately) and exits with the same code go test did.
Two things gofasta adds on top:
- Coverage summary. When
--coverageis set, aftergo testfinishes gofasta readscoverage.outand printscoverage: X.X% of statementsso you see the total without runninggo tool cover -funcseparately. - JSON noise suppression. Under
--json, the banner + the▶ go test ...progress line + the coverage summary are suppressed so stdout stays a strict NDJSON stream.
When to use
- In a project. Always — it’s shorter than
go test -race ./...and the gofasta CLI already knows your project conventions. - In CI. Pair with
--jsonand pipe togotestsum(or GitHub Actions’--json-inputreporter) for structured test output. - For coverage.
gofasta test --coverageis the one-shot way;gofasta verifyruns the full preflight suite (lint + race + build + …) when you want a stricter gate.