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

Codemod tests from createClass to ES2015 classes #7321

Merged
merged 2 commits into from
Jul 23, 2016

Conversation

keyz
Copy link
Contributor

@keyz keyz commented Jul 20, 2016

Codemodded automatically using https://github.com/reactjs/react-codemod#explanation-of-the-new-es2015-class-transform-with-property-initializers.

Reviewers: @sebmarkbage @spicyj

codemod log:

$ ../react-codemod/node_modules/.bin/jscodeshift -t ./transforms/class.js --mixin-module-name=ReactComponentWithPureRenderMixin --flow=true --pure-component=false --explicit-require=false ./src
Processing 343 files...
Spawning 7 workers...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
./src/renderers/dom/server/__tests__/ReactServerRendering-test.js: `Bar` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/dom/client/__tests__/ReactMount-test.js: `Component` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js: `Apple` was skipped because of inconvertible mixins.
./src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/addons/transitions/ReactCSSTransitionGroupChild.js: `ReactCSSTransitionGroupChild` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Outer` was skipped because of invalid field(s) `componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Inner` was skipped because of invalid field(s) `componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/test/__tests__/ReactTestUtils-test.js: `SomeComponent` was skipped because of invalid field(s) `componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/addons/link/__tests__/LinkedStateMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js: `Anon` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js: `Orange` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/art/ReactART.js: `Surface` was skipped because of inconvertible mixins.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Row` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `FancyRow` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Viz1` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `App1` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Viz2` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `App2` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponentState-test.js: `` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/__tests__/ReactPerf-test.js: `` was skipped because of invalid field(s) `shouldComponentUpdate, componentWillMount, componentDidMount, componentWillReceiveProps, componentWillUpdate, componentDidUpdate, componentWillUnmount, render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactStateSetters-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClass-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of invalid field(s) `onMouseEnter, onMouseLeave, onClick` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of invalid field(s) `onClick, badIdeas` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactBind-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBind-test.js: `TestBindComponent` was skipped because of invalid field(s) `onMouseEnter, onMouseLeave, onClick, badIdeas` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Box` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Child` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Switcher` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `App` was skipped because of inconvertible mixins.
./src/isomorphic/classic/element/__tests__/ReactElement-test.js: `Component` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
All done.
Results:
0 errors
0 unmodified
289 skipped
54 ok
Time elapsed: 8.729seconds

Then I reverted some non-test files and things under ./src/isomorphic/classic/class.

@sophiebits
Copy link
Collaborator

Just 10 files? We have 53 that have createClass in them…

@keyz
Copy link
Contributor Author

keyz commented Jul 20, 2016

@spicyj oops, I forgot to turn off explicit-require. We require 'React' instead of 'react' in our tests.

@ghost ghost added the CLA Signed label Jul 20, 2016
@sophiebits
Copy link
Collaborator

Is it because we usually require in beforeEach instead of at the top level?

@keyz
Copy link
Contributor Author

keyz commented Jul 21, 2016

@spicyj yeah, I was wrong -- our codemod only searches for variable declarators and ES6 imports but not assignments (https://github.com/reactjs/react-codemod/blob/master/transforms/utils/ReactUtils.js#L28).

I re-ran the codemod and updated the PR. There are some failing tests and they'll be fixed by #7326 and babel/babel#3589.

@sophiebits
Copy link
Collaborator

Accepting, feel free to merge when the babel stuff is sorted out.

@ghost ghost added the CLA Signed label Jul 22, 2016
@sebmarkbage
Copy link
Collaborator

This is really exciting!

Keyan Zhang added 2 commits July 23, 2016 15:16
@keyz keyz merged commit 484f96b into facebook:master Jul 23, 2016
@keyz keyz deleted the codemod-es6-component branch July 23, 2016 23:37
@zpao zpao modified the milestones: 15-next, 15.3.1 Aug 12, 2016
zpao pushed a commit that referenced this pull request Aug 12, 2016
Codemod tests from createClass to ES2015 classes
(cherry picked from commit 484f96b)
koba04 added a commit to koba04/react that referenced this pull request Sep 8, 2016
koba04 added a commit to koba04/react that referenced this pull request Sep 8, 2016
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.

5 participants