-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Mocha's afterEach is missing "this" #3895
Comments
This might be because Cypress 3.x is using an old version of Mocha ( Edit: It has been upgraded to Mocha 5.x |
Closing this as duplicate of #2528 @chrisbreiding Can you verify this will be fixed with Mocha upgrade? |
This is no longer
context('Mocha afterEach', () => {
beforeEach(function () {
expect(this).to.be.not.undefined
expect(this).to.have.property('currentTest')
})
afterEach(function () {
expect(this).to.be.not.undefined
expect(this).to.have.property('currentTest')
})
it('This', () => {
expect(this).to.be.not.undefined
expect(this).to.have.property('test')
})
}) 3.8.34.0.0 |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior:
In mocha it's documented behaviour that you can access
this
, which in turn gives access to currentTest. SeeMocha.IBeforeAndAfterContext;
just like inbeforeEach
.With Cypress intercepting
this
and inserting the screenshooter there, it misses to pass on thethis
project, here's the code I found in the debugger:where
fn
is the user-definedafterEach
functionDesired behavior:
this
should be passed on.fn.call(this)
would achieve that (in the context of the code above).Steps to reproduce: (app code and test code)
Versions
Cypress 3.2.0
The text was updated successfully, but these errors were encountered: