Allow context in before hook
See original GitHub issueIt would be useful to have context available in before
hooks, so that messy workarounds like in https://github.com/avajs/ava/issues/1542 aren’t required. It’s useful in cases where you’re doing integration testing and are downloading several URLs whose content will be used across multiple tests.
Without being able to share context in before hooks you would need to resort to the workaround, or download the page for each test each time, even though the content doesn’t change between tests.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
RSpec 3 RuntimeError: "let declaration accessed in a `before ...
You can't refer to a let variable (or subject ) in a before(:all) / before(:context) hook. Doing so was deprecated in RSpec 2...
Read more >Shared contexts that access a `let` method in a before hook ...
You have a shared context that defines a let method. That shared context accesses the let method in a before hook. The example...
Read more >`before` and `after` hooks - RSpec Core 3.9 - Relish
Use before and after hooks to execute arbitrary code before and/or after the body of an example is run: before(:example) # run before...
Read more >What are Cucumber Hooks And How to Use ... - Tools QA
Cucumber supports hooks, which are blocks of code that run before or after each scenario. You can define them anywhere in your project...
Read more >Context - React
When to Use Context; Before You Use Context ... Every Context object comes with a Provider React component that allows consuming components to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The functionality has landed in #1657 but it still needs to be documented. @kugtong33 is awesome and on the case though!
@novemberborn
These are the steps of what I understood about the problem
context
object before passing it to thebefore
hookcontext
usingObject.create
then pass it to thebeforeEach
hook if there is one, else pass it to thetest
so that each test will have their own clone ofcontext