Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@haitaoli
Copy link
Contributor

@haitaoli haitaoli commented Jun 27, 2017

If you select only one test case to run in xcode test navigator, the test can fail with error:

'NSInternalInconsistencyException', reason: ''beforeEach' cannot be used inside 'it', 'beforeEach' may only be used inside 'context' or 'describe'. ', userInfo: '(null)'

During test run world.currentExampleMetadata is set to current example, but it's never cleared. So once an example runs, no beforeEach can be called after it.

  • What behavior was changed?
    Before the example finishes running, clear Clear world.currentExampleMetadata.
  • What code was refactored / updated to support this change?
    Example.run()
  • What issues are related to this PR? Or why was this change introduced?

Checklist - While not every PR needs it, new features should consider this list:

  • Does this have tests?
  • Does this have documentation?
  • Does this break the public API (Requires major version bump)?
  • Is this a new feature (Requires minor version bump)?

@QuickBot
Copy link

1 Warning
⚠️ Need to add an unit test if you’re modifying swift source

Generated by 🚫 danger

@ikesyo
Copy link
Member

ikesyo commented Sep 9, 2017

Sorry for the late response, but I'm not sure what you are suffering from. Could you provide a reproducible case (project)?

@haitaoli
Copy link
Contributor Author

@ikesyo you don't need a repro project. Just try running one test case from xcode test navigator.

@ikesyo
Copy link
Member

ikesyo commented Sep 23, 2017

@haitaoli Fortunately (or unfortunately?) I can't reproduce it.

Copy link
Member

@ikesyo ikesyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the change is needed to make Xcode 10's parallel testing feature working. So Let's go ahead! 🚀

@haitaoli
Copy link
Contributor Author

haitaoli commented Jul 5, 2018

Thanks!

@ikesyo ikesyo mentioned this pull request Jul 12, 2018
1 task
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

Successfully merging this pull request may close these issues.

4 participants