Feature/skip describe standalone#84
Open
sockol wants to merge 3 commits into
Open
Conversation
added 2 commits
April 15, 2020 23:12
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 as g.Xit() tests - they do not run. Each Describe and It block within a Skip.Describe() will be logged in yellow.
Add a test for g.Skip.Describe()
afa2e4e to
e7ca9ce
Compare
Author
|
bumping this pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.Describeblock 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
Xdescribewhich holdsDescribe.The issue I ran into when trying to implement this is that each It and Describe block currently has a
.parentfield which references a*Describeblock.That would require a big refactor to convert every Describe and Xdescribe block to implement the same interface so that the
.parentin 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