reporting
Что он делает
Этот скилл объясняет, как управлять видом результатов тестов Ginkgo и сохранять их в машиночитаемых отчётах. Он нужен разработчикам, которым нужен понятный вывод тестов или отчёты для других инструментов.
Когда использовать
- ✓Когда вы хотите видеть больше или меньше деталей в результатах тестов на экране.
- ✓Когда нужен файл отчёта JSON или JUnit из ваших тестов Ginkgo.
- ✓Когда вы хотите проверить покрытие кода или производительность тестов Go.
Ссылка на скилл
https://github.com/onsi/ginkgo/blob/master/plugins/ginkgo/skills/reporting/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Сделай так, чтобы мои тесты Go сохраняли отчёт JUnit, который может прочитать наша система CI.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Скилл показывает опции команд, которые выводят подробный вывод, записывают файлы отчётов и измеряют покрытие или скорость.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Reporting and profiling
How to produce reports and feed data into them. To read a failing report as an agent (the jq failure-diagnosis workflow), see ginkgo:debugging-failures. Docs: https://onsi.github.io/ginkgo/#generating-machine-readable-reports and https://onsi.github.io/ginkgo/#attaching-data-to-reports.
Console output
| Flag | Effect |
|---|---|
--succinct |
Minimal (default when running multiple suites). |
| (none) | Normal — detail only for failed specs (default, single suite). |
-v |
Full timeline for every spec; streams live in series. |
-vv |
-v plus node > Enter/< Exit events and every failure (not just the primary). |
--trace |
Full stack trace on every failure, not just panics. |
--no-color / GINKGO_NO_COLOR=TRUE |
Disable color. |
--github-output |
Format console output for GitHub Actions. |
In parallel (-p), -v/-vv timelines can't stream — the streams would interleave, so Ginkgo emits each spec's full timeline after that spec completes. → CI flags in ginkgo:ci.
Machine-readable reports
ginkgo -r --json-report=report.json --output-dir=./.reports
--json-reportis native and richest — an array oftypes.Report, each withSpecReports[]oftypes.SpecReport(godoc); build tooling against thetypespackage.--junit-report=x.xml,--teamcity-report=x,--gojson-report=x.go.jsonexist for external CI but lose Ginkgo metadata — use them to feed a system, not to diagnose. (JUnit maps aLabel("owner:XYZ")to theOwnerattribute.)--output-dir=DIRcollects all files in one place; under-rall suites merge into one report file.--keep-separate-reportswrites onePACKAGE_report.jsonper package instead.- Every machine-readable report embeds the full
-vvtimeline regardless of console verbosity. Run the suite quiet and mine the file — you don't need-vvon the console to get rich detail in the report.
Programmatic reporting nodes
CurrentSpecReport() works in any run-phase closure — use it for in-spec conditional diagnostics:
AfterEach(func() {
if CurrentSpecReport().Failed() {
GinkgoWriter.Println(libraryClient.DebugLogs()) // expensive diagnostics, only on failure
}
})
For custom report files, don't roll your own in AfterEach — use reporting nodes:
ReportAfterEach(func(r SpecReport){...})/ReportBeforeEach— run for every spec including skipped/pending (unlikeAfterEach), after allAfterEaches. A failure here fails the spec. In parallel they run on each process concurrently — never write a shared file from them (you'll get interleaved garbage).ReportBeforeSuite/ReportAfterSuite("name", func(r Report){...})— top-level, and run only on process #1.ReportAfterSuitereceives theReportaggregated across all parallel processes — this is the safe place for custom suite-level report files:
ReportAfterSuite("custom report", func(report Report) {
f, _ := os.Create("report.custom")
for _, sr := range report.SpecReports {
fmt.Fprintf(f, "%s | %s\n", sr.FullText(), sr.State)
}
f.Close()
})
Reporting nodes can be made interruptible by also accepting SpecContext → ginkgo:timeouts-and-async.
Attaching data to a spec: AddReportEntry
It("is reported", func() {
AddReportEntry("Publish stats", stats, ReportEntryVisibilityFailureOrVerbose)
})
AddReportEntry(name, value, ...args) attaches arbitrary data to the current spec; it lands in SpecReport.ReportEntries, in all machine-readable reports, and (per visibility) on the console. Visibility enum:
ReportEntryVisibilityAlways(default) — always printed.ReportEntryVisibilityFailureOrVerbose— only on failure or-v(likeGinkgoWriter).ReportEntryVisibilityNever— never on console, but still in the JSON report.
For failure-only diagnostics, call AddReportEntry from a DeferOnFailure callback (→ ginkgo:writing-specs).
value is JSON-round-tripped into the report (retrieve via entry.GetRawValue() / json.Unmarshal(entry.Value.AsJSON, ...)). A fmt.Stringer/types.ColorableStringer controls console rendering; pass a pointer to capture later mutations. AddReportEntry decorators (Offset, CodeLocation, ReportEntryVisibility) → ginkgo:decorators.
Recap (owned by ginkgo:writing-specs): GinkgoWriter buffers log output a
Частые вопросы
Что такое отчёт JUnit?
Это стандартный формат файла, который могут прочитать многие системы сборки и тестирования, чтобы показать результаты.
Можно ли видеть каждый тест во время запуска?
Да, подробные опции показывают хронологию каждого теста, хотя при параллельных запусках хронология выводится после завершения теста.
Меняет ли этот скилл сами тесты?
Он в основном описывает опции команд и код отчётов, поэтому ваши тесты остаются прежними, если вы не добавите шаги отчётности.
Подробности
Оригинальное описание автора
Generate, consume, and enrich Ginkgo reports — console verbosity (-v/-vv/--trace/--no-color/--succinct), machine-readable reports (--json-report/--junit-report with --output-dir/--keep-separate-reports), programmatic reporting nodes (ReportAfterEach, ReportAfterSuite, CurrentSpecReport), AddReportEntry with ReportEntryVisibility, and profiling (--cover/--race/--cpuprofile/--memprofile). Use when you need a report file, custom suite-level reporting, attaching data to a spec, controlling console output, or profiling a suite.
repo: onsi/ginkgo
Популярность
- Звёзды на GitHub
- 9.1k
- Место в рейтинге
- #12305
- Лицензия
- MIT
- Обновлён
- 09.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
ci
9.1kПомогает агенту настроить тесты Ginkgo для непрерывной интеграции с рекомендуемыми флагами, которые ловят оставленные метки focus и pending, а также нестабильные тесты.
debugging-failures
9.1kПомогает агенту понять, почему тесты Ginkgo упали: он читает строку с итогом и достаёт точные падающие тесты и сообщения из JSON-отчёта.
decorators
9.1kПомогает агенту правильно использовать декораторы тестов Ginkgo, например Serial, Ordered, Label, Focus и таймауты, объясняя, что делает каждый из них.
filtering
9.1kПомогает агенту запускать только часть тестов Ginkgo, используя pending, skip, focus, метки, ограничения версий и фильтры по файлам в правильном порядке приоритетов.
Похожие скиллы
test-driven-development
311kУчит агента сначала писать падающий тест, увидеть, что он падает, и только затем писать минимальный код, который его проходит, прежде чем создавать любую функцию или исправление.
verification-before-completion
311kУчит агента запускать настоящие проверки и читать их вывод, прежде чем утверждать, что задача, исправление или сборка готовы или проходят.
migrate-to-shoehorn
310kЗаменяет рискованные приведения типов в тестовых файлах на библиотеку shoehorn, чтобы тесты могли использовать неполные данные и проходить проверку типов.