-
Notifications
You must be signed in to change notification settings - Fork 194
feat(*) allow helpers to extend busted #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LGTM! |
shouldn't this "flaky" functionality be added to the Busted core? The way it is used now is occupying the |
Thinking out loud here... If not in the core, can we load it from a spec file? so at the top of a spec file a call is added |
the reason I did write it as an extension is because the implementation to block messages signaling failed is not ideal. The part that adds a third argument to blocks to define block level arguments could be interesting, though. Shouldn't --helper flags accept arbitrary entries like |
How about this then:
|
¯\_(ツ)_/¯ rather than fixing the actual issue ? loading the helper from the spec file is a very lousy solution. If you want to use two helpers, it's possible to add a helper file that loads both helpers |
I love the idea of adding extensions like flaky. If a spec file is using the Am I misunderstanding the requirement? |
it also feels weird to modify the command line |
Yet another option I just thought of is to write a helper module that loads additional defined helpers in the busted config file but 🤷 |
One of the ideas behind Tagging Just to make sure I am not missing something, is the question if it makes sense to add a
It's not really a dependency. It's an extension that gets "installed" before tests are run. At the time, when I went through
That would work too. I still think the most straightforward way of dealing with @Tieske issue is recommending on my side a -- This would already load trivial helpers
require "some.helper"
local helpers = {
-- Let's say this is a complex helper that returns a function
require "another.helper",
-- ...
require "flaky",
}
return function(busted, helper, options)
return tx_reduce(function(h, r) r and h(busted, helper, options) end, helpers, true)
end |
Conceptually I think that if a spec file needs those helpers because it contains flaky tests, it should be explicitly in that spec file to make that clear. That's why I advocated for an extra call in the spec file, visibility, and being self-contained. Reminds me of the |
that's a discussion on `flaky-busted` and not `busted` on itself.
An extension must apply over the whole runner and not a particular file for
it to be an extension.
What if someone wanted to create an extension called `busted-rollbar` that
sends error tracebacks to a rollbar service. Would that apply to only a set
of files?
…On Mon, Mar 8, 2021, 10:46 Thijs Schreijer ***@***.***> wrote:
One of the ideas behind busted-flaky is the possibility of using it
without having to change anything on your spec files.
Conceptually I think that if a spec file needs those helpers because it
contains flaky tests, it should be explicitly in that spec file to make
that clear. That's why I advocated for an extra call in the spec file,
visibility, and being self-contained.
Reminds me of the _TEST global that was set in Busted 1.x, it was removed
for the same reason, if your tests need it, add it explicitly. imo this is
best-practice.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#658 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTAOFW7OSTDGG4OQUJLLDTCSMJDANCNFSM4XXB2YPA>
.
|
good point @eskerda 👍 |
@DorianGray revisiting this. I don't like the flaky implementation, since it's a hack. Yet, the changes here in Busted itself seem reasonable. Though I'd still love to see in Busted itself: flaky(5, function()
-- test goes here
end) |
8a5d40d
to
6a65a9a
Compare
This change allows helpers to extend busted functionality by exposing its internals. That's the only way I found to add new blocks, happy to discuss alternatives.
See eskerda/busted-flaky for an example on how to leverage this feature.