Add async/await to unit tests; modify server rendering tests to use async/await.#9089
Merged
sophiebits merged 12 commits intofacebook:masterfrom Mar 3, 2017
Merged
Conversation
… which will soon be merged into master.
…eworked wording of test names, corrected use of canUseDom, and simplified tests against tagName. Thanks for the help, @spicyj!
sophiebits
requested changes
Mar 1, 2017
Collaborator
sophiebits
left a comment
There was a problem hiding this comment.
Looks great assuming CI passes, just two inlines.
scripts/jest/preprocessor.js
Outdated
| ) { | ||
| // for test files, we also apply the async-await transform, but we want to | ||
| // make sure we don't accidentally apply that transform to product code. | ||
| var isTestFile = !!filePath.match(/__tests__/); |
Collaborator
There was a problem hiding this comment.
Can we do .match(/\/__tests__\//)?
| domElement.innerHTML = markup; | ||
| return domElement.firstChild; | ||
| }); | ||
| errorCount); |
Collaborator
There was a problem hiding this comment.
nit: fb style is to have this closing ); on the next line, unindented
Contributor
Author
|
Thanks for the review; addressed in ec62549. Now crossing my fingers on CI. |
Contributor
Author
|
Looks like CI has passed, and I think I've addressed all comments in the review. Can I humbly give this PR a nudge? |
Collaborator
|
Yes of course! I don't get notified when CI runs :( |
gaearon
pushed a commit
that referenced
this pull request
Mar 19, 2017
* Added a handful of SSR unit tests, ported from a previous pull request. * Fixing linting errors * Fixed a test helper function to properly report errors. * Un-nested the new rendering tests. Updated the fiber test passing/not passing lists. * Edited to comply with the react/jsx-space-before-closing eslint rule, which will soon be merged into master. * Response to code review from @spicyj. Moved tests to separate file, reworked wording of test names, corrected use of canUseDom, and simplified tests against tagName. Thanks for the help, @spicyj! * Converted the unit tests to use async-await style. * Moved async-await babel transform for tests from .babelrc to preprocessor.js. * Response to code review in PR #9089. Thanks, @spicyj! * Fixing some bugs in the SSR unit tests. * Missed deleting some repeated code in the last commit. * Adding unit tests for property to attribute mapping in SSR. * Removing some redundant unit tests. * Oops. I forgot to re-run record-tests after c593dbc; fixing that here. * Reformatting for prettier so that the build will pass.
This was referenced Mar 20, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following on to #9055, this PR adds the ability to use async-await to unit tests, and it changes some of the existing server rendering tests to use async-await.
At @spicyj's suggestion in #9055, the transform is only applied to files in the
__tests__folders to avoid accidentally transforming shipping product code.