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
5 changes: 5 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ name: Quality Assurance
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review

# Cancel prior runs on the same branch when a new one starts
concurrency:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- `testo.Options` now returns an empty struct to enable `var _ = testo.Options(...)` usage.

## [1.2.0] - 2026-05-21

### Added
Expand Down
10 changes: 4 additions & 6 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ func Test(t *testing.T) {
Using `testo.Options`:

```go
func init() {
testo.Options(
myplugin.SomeOption(),
otherplugin.OtherOption(42),
)
}
var _ = testo.Options(
myplugin.SomeOption(),
otherplugin.OtherOption(42),
)

func Test(t *testing.T) {
// options are automatically passed to these RunSuite calls.
Expand Down
10 changes: 9 additions & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ var (
// func init() {
// testo.Options(myplugin.OutputDir("..."))
// }
func Options(options ...testoplugin.Option) {
//
// It returns an empty struct to enable the following usage:
//
// var _ = testo.Options(...)
//
// This is similar to [For] and slightly more concise than using init.
func Options(options ...testoplugin.Option) struct{} {
globalOptionsMutex.Lock()
defer globalOptionsMutex.Unlock()

globalOptions = append(globalOptions, options...)

return struct{}{}
}

func getOptions() []testoplugin.Option {
Expand Down
Loading