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

Fix error message of 'when fulfilled' with expect.it #198

Merged
merged 2 commits into from
Aug 8, 2015

Conversation

papandreou
Copy link
Member

No description provided.

}
};
if (expect.findTypeOf(nextAssertion).is('expect.it')) {
// Force a failing expect.it error message to be property nested instead of replacing the default error message:
Copy link
Member Author

Choose a reason for hiding this comment

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

@sunesimonsen Can you come up with an idea that could help avoid this construct? The special handling of errors from expect.it, that is.

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't the improved type system help here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it would, it seems like there's an expect.it quirk in play here. Ideally shifting to an expect.it and an assertion string should behave the same. If you check out the branch and remove the special casing of the expect.it here, the assertion inside the should fail with the right error message when the next assertion is an expect.it that fails test fails like this:

expected { foo: 'bar' } to have property 'foo' with a value of 'quux'

-bar
+quux

But I want it to fail like this:

expected Promise when fulfilled expect.it('to have property', 'foo', 'quux')
  expected { foo: 'bar' } to have property 'foo' with a value of 'quux'

  -bar
  +quux

papandreou added a commit that referenced this pull request Aug 8, 2015
Fix error message of 'when fulfilled' with expect.it
@papandreou papandreou merged commit 98fdfe3 into master Aug 8, 2015
@papandreou papandreou deleted the fix/whenFulfilledWithExpectIt branch August 17, 2015 21:36
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.

None yet

2 participants