ci
Fungsinya
Skill ini menyiapkan tes Go yang ditulis dengan Ginkgo agar berjalan andal di build otomatis. Skill ini ditujukan untuk pengembang yang ingin proses CI mereka menangkap kesalahan dan melaporkan hasil dengan jelas.
Kapan dipakai
- βSaat Anda menyiapkan tes Ginkgo di pipeline CI.
- βSaat tes Ginkgo lulus di komputer Anda tetapi berperilaku berbeda di CI.
- βSaat Anda ingin laporan tes yang bisa dibaca mesin dari proses otomatis.
Link skill
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/ci/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βSiapkan tes Go Ginkgo saya agar berjalan di CI dengan flag yang direkomendasikan dan laporan JSON.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menjalankan alat Ginkgo melalui go run agar versinya sesuai dengan proyek Anda, lalu menambahkan flag untuk urutan acak, eksekusi paralel, gagal jika ada penanda tertunda atau fokus yang tertinggal, dan laporan JSON.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Ginkgo in CI
A CI invocation should maximize signal β surface flakes and spec pollution, catch mistakes that pass locally, and emit machine-readable artifacts β while collecting every failure in one run. This builds on the CLI (ginkgo:running) and report formats (ginkgo:reporting). Full rationale: https://onsi.github.io/ginkgo/#recommended-continuous-integration-configuration.
The recommended flag set
Invoke via go run so the CLI version always tracks the github.com/onsi/ginkgo/v2 in your go.mod β no separately-installed binary to drift (β ginkgo:setup).
go run github.com/onsi/ginkgo/v2/ginkgo \
-r -p --randomize-all --randomize-suites \
--fail-on-pending --fail-on-empty --keep-going \
--cover --coverprofile=cover.profile --race --trace \
--json-report=report.json --output-dir=.ginkgo-report \
--timeout=TIMEOUT --poll-progress-after=Xs --poll-progress-interval=Ys
| Flag | Why |
|---|---|
-r |
recursively find and run every suite |
-p |
run each suite in parallel (β ginkgo:parallelism; set --procs=N/--compilers=N if CPU detection is wrong) |
--randomize-all / --randomize-suites |
shuffle all specs and the suite order to surface spec pollution (β ginkgo:running) |
--fail-on-pending |
fail if any Pending specs were committed |
--fail-on-empty |
fail if no specs ran (usually a malformed filter) |
--keep-going |
don't stop at the first failed suite β collect all failures |
--cover --coverprofile=cover.profile |
compute coverage into one merged profile (β ginkgo:reporting) |
--race |
run with the race detector (costs a fixed ~1s per suite β see below) |
--trace |
full stack traces on failure (worth it without a local feedback loop) |
--json-report=report.json |
structured results for diagnosis and downstream tools (β ginkgo:debugging-failures) |
--timeout=TIMEOUT |
cap the whole run (default 1h β often not enough) |
--poll-progress-after/--poll-progress-interval |
emit progress reports for stuck specs (β ginkgo:timeouts-and-async) |
The exit-code safeguards β CI's real value
Three flags turn "looks green" into "is actually trustworthy." They make CI fail on mistakes that pass silently on a developer's machine:
--fail-on-pendingβ a committedPending/PIt/XItbecomes a CI failure, so dev-time placeholders can't rot into the suite.--fail-on-emptyβ a typo'd--label-filter(or an over-aggressive--skip) that selects zero specs fails instead of falsely passing.- Committed programmatic focus already fails CI for free. A passing suite that contains
FIt/FDescribe/Focusexits non-zero β Ginkgo's built-in guard against shipping focus. Don't suppress it; fix it withginkgo unfocus(βginkgo:filtering).
Collecting artifacts
Point reports and profiles at one directory and upload it as a build artifact:
--output-dir=.ginkgo-reportcollects the JSON report (and, under-r, merges all suites into onereport.json) plus coverage/profiles into one place. βginkgo:reportingfor--keep-separate-reportsand the other formats.--junit-report=junit.xmladditionally if your CI system renders JUnit β but keep--json-reportas the source of truth; JUnit loses Ginkgo metadata.- An agent or human then diagnoses failures straight from
report.jsonwithjqβginkgo:debugging-failures.
CI-friendly console output
--github-outputβ formats the console log for GitHub Actions readability (grouped, annotated).--force-newlinesβ flush output line-by-line for CI systems that only flush on newline.--no-color(orGINKGO_NO_COLOR=TRUE) β drop ANSI codes from logs that don't render them.
The race detector's fixed per-suite cost
--race adds about a second to every suite, no matter how few specs it has. ThreadSanitizer sleeps for one second at process exit (atexit_sleep_ms, its default) so that races reported by goroutines still running at exit aren't lost, and Ginkgo has to wait for the processes it spawned. Under -r -p that lands in the gap between suites, where it looks exactly like compilation.
The tell is that it's flat across package size β a 2-spec package pays the same as a 2000-spec package. A build cost can't behave that way; a per-process cost must. If you're auditing a slow race-enabled run, measure with precompiled binaries (ginkgo build -r) so compilation is excluded by construction rather than by
Pertanyaan umum
Mengapa menjalankan Ginkgo melalui go run?
Agar versi alat Ginkgo tetap sama dengan yang ada di file go.mod Anda, sehingga tidak ada instalasi terpisah yang menyimpang.
Apa yang ditangkap oleh pemeriksaan keamanan?
Penanda fokus atau tertunda yang sudah ter-commit, serta filter yang tidak cocok dengan tes mana pun, karena bisa menyembunyikan kegagalan.
Mengapa urutan tes diacak?
Urutan acak membantu menemukan tes yang secara tidak sengaja bergantung satu sama lain.
Detail
Deskripsi asli dari pembuat
Configure Ginkgo for continuous integration β the recommended CLI flag set and the rationale for each flag (-r -p --randomize-all --randomize-suites --fail-on-pending --fail-on-empty --keep-going --cover --race --trace --json-report --timeout --poll-progress-after/-interval), invoking via go run to pin the CLI to go.mod, the exit-code safeguards that catch committed Focus/Pending and empty filters, collecting report and coverage artifacts with --output-dir, CI-friendly output (--github-output/--force-newlines/--no-color), and the fixed per-suite cost --race adds (GORACE=atexit_sleep_ms=0). Use
repo: onsi/ginkgo
Popularitas
- Bintang GitHub
- 9.1k
- Peringkat
- #12298
- Lisensi
- MIT
- Diperbarui
- 9/10/2026
Komentar
- β¦
Skill lain dari repositori ini
debugging-failures
9.1kMembantu agent Anda mencari tahu mengapa tes Ginkgo gagal dengan membaca baris ringkasan dan mengambil tes yang gagal beserta pesannya dari laporan JSON.
decorators
9.1kMembantu agent Anda memakai dekorator tes Ginkgo dengan benar, seperti Serial, Ordered, Label, Focus, dan batas waktu, dengan menjelaskan fungsi masing-masing.
filtering
9.1kMembantu agent Anda menjalankan hanya sebagian tes Ginkgo, memakai pending, skip, focus, label, batasan versi, dan filter file sesuai urutan prioritasnya.
ordering-and-flakes
9.1kMembantu agent Anda mengendalikan urutan tes Go dan menangani tes yang tidak stabil, dengan pengaturan Serial dan Ordered dari Ginkgo serta opsi percobaan ulang.
Skill serupa
test-driven-development
311kMengajari agent Anda menulis tes yang gagal dulu, melihatnya gagal, lalu menulis kode terkecil yang lulus, sebelum membangun fitur atau perbaikan apa pun.
verification-before-completion
311kMengajari agent Anda menjalankan pemeriksaan nyata dan membaca keluarannya sebelum menyatakan tugas, perbaikan, atau build sudah selesai atau lulus.
migrate-to-shoehorn
310kMengganti type cast berisiko di file tes Anda dengan pustaka shoehorn, sehingga tes bisa memakai data parsial dan tetap lulus pemeriksaan tipe.