Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivations
Goblin is inspired by Mocha, and Mocha has a set of functions that allows you to skip tests.
Goblin supports skipping with Xit().
Mocha allows you to invoke tests with a skip() function:
Since Go does not allow us to have a struct and a function with the same name we cannot have
Alternatively, and as a way to set up skipping It tests in a future PR, we can follow this pattern:
Changes made
Add the ability to skip all tests within a describe block if it was added using
g.Skip.Describe()
.The before and after hooks on a skipped test in this
Skip.Describe
block behave the same way asg.Xit()
tests - they do not run. Each Describe and It block within aSkip.Describe()
will be logged in yellow.Add a test for
g.Skip.Describe()
Alternatives considered:
Tried adding a new struct
Xdescribe
which holdsDescribe
.The issue I ran into when trying to implement this is that each It and Describe block currently has a
.parent
field which references a*Describe
block.That would require a big refactor to convert every Describe and Xdescribe block to implement the same interface so that the
.parent
in every It and Describe will refer to this interface likeRunnable()
.I am not completely clear if this will work, but looking for feedback if you guys think this is the preferred solution @marcosnils @xetorthio