-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Improve e2e-kitchensink and Jest coverage #1484
Closed
Closed
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d99a17c
Less magic is better for the future generations.
Timer 271d5b8
Notify rendered in Jest
Timer 8834940
Throw for an unknown test
Timer b860241
Naming changes
Timer 247e598
Add comment
Timer 50b503e
Use react-app preset
Timer 1835ab6
Switch out envs
Timer d75c0b1
Unlink before eject
Timer 73b946c
Remove redundant NODE_ENVs
Timer 082b35b
Remove more
Timer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"presets": ["latest"] | ||
"presets": ["latest"], | ||
"plugins": ["transform-class-properties"] | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
import React from 'react'; | ||
import React, { Component, PropTypes, createElement } from 'react'; | ||
|
||
class BuiltEmitter extends React.Component { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've got There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My mistake. Thanks! |
||
constructor(props) { | ||
super(props) | ||
|
||
this.callWhenDone = done => done(); | ||
static propTypes = { | ||
feature: PropTypes.func.isRequired | ||
} | ||
|
||
componentDidMount() { | ||
this.callWhenDone(() => document.dispatchEvent(new Event('ReactFeatureDidMount'))); | ||
const { feature } = this.props | ||
|
||
// Class components must call this.props.onReady when they're ready for the test. | ||
// We will assume functional components are ready immediately after mounting. | ||
if (!Component.isPrototypeOf(feature)) { | ||
this.handleReady(); | ||
} | ||
} | ||
|
||
render() { | ||
const feature = React.cloneElement(React.Children.only(this.props.children), { | ||
setCallWhenDone: done => { | ||
this.callWhenDone = done; | ||
} | ||
}); | ||
handleReady() { | ||
document.dispatchEvent(new Event('ReactFeatureDidMount')); | ||
} | ||
|
||
return <div>{feature}</div>; | ||
render() { | ||
const { | ||
props: { feature }, | ||
handleReady | ||
} = this; | ||
return ( | ||
<div> | ||
{createElement(feature, { | ||
onReady: handleReady | ||
})} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
|
@@ -105,9 +117,7 @@ class App extends React.Component { | |
case 'unknown-ext-inclusion': | ||
require.ensure([], () => this.setFeature(require('./features/webpack/UnknownExtInclusion').default)); | ||
break; | ||
default: | ||
this.setFeature(null); | ||
break; | ||
default: throw new Error('Unknown feature!'); | ||
} | ||
} | ||
|
||
|
@@ -116,8 +126,11 @@ class App extends React.Component { | |
} | ||
|
||
render() { | ||
const Feature = this.state.feature; | ||
return Feature ? <BuiltEmitter><Feature /></BuiltEmitter> : null; | ||
const { feature } = this.state; | ||
if (feature !== null) { | ||
return <BuiltEmitter feature={feature} />; | ||
} | ||
return null; | ||
} | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
20 changes: 11 additions & 9 deletions
20
packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.js
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
12 changes: 10 additions & 2 deletions
12
packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.js
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use our own preset here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question -- this is how it was; I'll look into switching it.