Skip to content

Fix SSR integration test swallowing lack of expected error #10331

Merged
gaearon merged 2 commits intofacebook:masterfrom
gaearon:fix-ssr-error-assertions
Jul 31, 2017
Merged

Fix SSR integration test swallowing lack of expected error #10331
gaearon merged 2 commits intofacebook:masterfrom
gaearon:fix-ssr-error-assertions

Conversation

@gaearon
Copy link
Copy Markdown
Collaborator

@gaearon gaearon commented Jul 31, 2017

We have some tests that check that expected errors are thrown.
These tests use a helper called itThrowsWhenRendering.

Currently, there is a bug in this helper. When there is no error (but an error is expected), it tries to fail the test with expect(false).toBe('The promise resolved and should not have.'). However the catch() block catches and swallows this exception.

The fix is to attach the error handler to the original Promise rather than to the one after our handler.

This fix exposes two missing expected errors in new SSR related to context. The second commit fixes them by adding the respective invariants.

To future proof this, I want to assert on specific error messages instead. I will do so in a follow up PR.

Copy link
Copy Markdown
Contributor

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

Another instance of jestjs/jest#3917 gone wrong.

gaearon added 2 commits July 31, 2017 17:04
Previously, even if an error was not thrown, the assertion about this was ignored.

This fix exposes two failing cases in new SSR that weren't failing in Stack.
This fixes the error cases that were silently failing before but are now exposed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants