Skip to content

feat(fixtures): accept multiple fixture files (closes #910)#1590

Open
0xdeadd wants to merge 1 commit into
stripe:masterfrom
0xdeadd:feat/fixtures-multi-file
Open

feat(fixtures): accept multiple fixture files (closes #910)#1590
0xdeadd wants to merge 1 commit into
stripe:masterfrom
0xdeadd:feat/fixtures-multi-file

Conversation

@0xdeadd
Copy link
Copy Markdown

@0xdeadd 0xdeadd commented May 14, 2026

Closes #910.

The fixtures command previously required exactly one file argument. This extends it to accept one or more files, executed sequentially in the order given.

stripe fixtures ./customer.json ./subscription.json ./teardown.json

Behavior

  • UpdateEnv is called after each fixture, so later files can reference vars produced by earlier ones via ${.env:VAR}.
  • Execution aborts on the first error rather than continuing, to preserve the established single-file behavior and surface failures immediately. Users who want try-each semantics can chain at the shell level.
  • The existing single-file invocation continues to work unchanged.

Implementation

  • Added a MinimumNArgs validator to pkg/validators/cmds.go, mirroring the existing MaximumNArgs, since the package only had Exact and Maximum variants. Includes tests.
  • Switched the fixtures command from validators.ExactArgs(1) to validators.MinimumNArgs(1) and wrapped the runner body in a per-file loop.
  • Updated the command's Use and Long to reflect the new shape.

Test

$ go test ./pkg/validators/... ./pkg/fixtures/...
ok  	github.com/stripe/stripe-cli/pkg/validators	0.204s
ok  	github.com/stripe/stripe-cli/pkg/fixtures	0.283s

gofmt and go vet clean.

The fixtures command previously required exactly one file argument. This
extends it to accept one or more files, executed sequentially in the
order given. Closes stripe#910.

UpdateEnv is called after each fixture so later files can reference
vars produced by earlier ones via ${.env:VAR}. Execution aborts on the
first error to preserve the established single-file behavior and
surface failures immediately.

Adds a MinimumNArgs validator mirroring the existing MaximumNArgs, with
tests, since the validators package only had Exact and Maximum
variants.
@0xdeadd 0xdeadd requested a review from a team as a code owner May 14, 2026 14:33
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 14, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stripe fixtures support for multiple file inputs

1 participant