Skip to content
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

After / AfterEach lose the context #2

Open
NeverI opened this issue Dec 1, 2014 · 4 comments
Open

After / AfterEach lose the context #2

NeverI opened this issue Dec 1, 2014 · 4 comments

Comments

@NeverI
Copy link

NeverI commented Dec 1, 2014

Hi again,

I cannot write test without this library anymore, so thanks 👍
But here is a little issue:

describe 'test', ->
  Given -> @value = 'foo'

  afterEach -> console.log @value  # will be undefined
@TheLudd
Copy link
Owner

TheLudd commented Mar 25, 2015

I have noticed this as well. Will look into it.

@yeehaa123
Copy link

Hi, I'm running into this issue too. Any workarounds?

@TheLudd
Copy link
Owner

TheLudd commented Jun 11, 2015

Did some research here and it seems like an implementation detail causes this error. At first glance it will be difficult to fix.

Just to get things straight... We are talking about afterAll here? No afterEach is defined.

The afterAll is defined in a parent suite wrapping all describe blocks in the file. I am guessing that this causes the error. If I put the afterAll on the same level as the files main describe block the error seems to disappear but a whole lot of other errors occur.

@yeehaa123
Copy link

@TheLudd No, actually, it is afterEach that does not work properly. Like @NeverI shows in his example, instance variables are undefined in afterEach blocks

Love the library, btw. Thanks for all the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants