Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add some way to aggregate expectation failures within a block #45

Open
brandonsturgeon opened this issue Mar 1, 2023 · 0 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@brandonsturgeon
Copy link
Member

Sometimes if you need to run a lot of expectations, you want to know about all of the failures rather than just the first one.

Ruby's RSpec accomplishes this like so:

it "returns success response from stripe" do
  aggregate_failures "stripe response" do
    expect(refund.amount).to eq 100
    expect(refund.status).to eq "succeeded"
    expect(refund.id).to start_with "re_"
  end
end

Ruby has the blessing of lots of block contexts, but we could maybe mimic that feature like so:

aggregateFailures( "stripe response", function()
    expect( refund.amount ).to.equal( 100 )
    expect( refund.status ).to.equal( "succeeded" )
    expect( string.StartsWith( refund.id, "re_" ) ).to.beTrue()
end )

No doubt a nightmare to implement in the current runner code (bump on #24)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant