Commit Graph

191 Commits

Author SHA1 Message Date
Ben Alpert
b1768b5a48 Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00
Brian Vaughn
2beec2f308 createClass + PropTypes + checkPropTypes warnings (#9399)
(Temporarily) re-adds getters with deprecation warnings for React.PropTypes, React.checkPropTypes, and React.createClass.

* 08bd020: Replace all references to React.PropTypes with prop-types to avoid triggering our own warning message.
* ef5b5c6: Removed several references to React.createClass that appeared after rebasing this branch. (reviewed by @flarnie)
* 524ce20: Added getters for createClass and PropTypes to the main React isomorphic object, behind one-time warning messages. (reviewed by @spicyj)
* db48f54: Fixed Rollup bundles to inline 'prop-types' and 'create-react-class' for UMD builds only. (reviewed by @spicyj, @trueadm )
* cf49cfd: Updated tests-passing.txt to remove tests that were deleted in this branch.
* d34109a: Responses to PR feedback from @spicyj. (Added package.json dependencies to packages/react and packages/react-dom. Renamed a var. Expanded on an inline comment.)
* 488c8d2: Added warning for moved package to React.checkPropTypes accessor too and updated build script.
* 83bcb29: Wordsmithing for deprecation notices (added fb.me links).
* afdc9d2: Tweaked legacy module inlining to remove order-of-deps constraint
* d1348b9: Removed $FlowFixMe.
* 7dbc3e7: More wordsmithing of deprecation notices based on Dan's feedback.
2017-04-11 14:28:03 -07:00
Dominic Gannaway
4b2eac3de7 Convert current build system to Rollup and adopt flat bundles (#9327)
* WIP

* fbjs support

* WIP

* dev/prod mode WIP

* More WIP

* builds a cjs bundle

* adding forwarding modules

* more progress on forwarding modules and FB config

* improved how certain modules get inlined for fb and cjs

* more forwarding modules

* added comments to the module aliasing code

* made ReactPerf and ReactTestUtils bundle again

* Use -core suffix for all bundles

This makes it easier to override things in www.

* Add a lazy shim for ReactPerf

This prevents a circular dependency between ReactGKJSModule and ReactDOM

* Fix forwarding module for ReactCurrentOwner

* Revert "Add a lazy shim for ReactPerf"

This reverts commit 723b402c07116a70ce8ff1e43a1f4d92052e8f43.

* Rename -core suffix to -fb for clarity

* Change forwarding modules to import from -fb

This is another, more direct fix for ReactPerf circular dependency

* should fix fb and cjs bundles for ReactCurrentOwner

* added provides module for ReactCurrentOwner

* should improve console output

* fixed typo with argument passing on functon call

* Revert "should improve console output"

This breaks the FB bundles.

This reverts commit 65f11ee64f678c387cb3cfef9a8b28b89a6272b9.

* Work around internal FB transform require() issue

* moved  ReactInstanceMap out of React and into ReactDOM and ReactDOMFiber

* Expose more internal modules to www

* Add missing modules to Stack ReactDOM to fix UFI

* Fix onlyChild module

* improved the build tool

* Add a rollup npm script

* Rename ReactDOM-fb to ReactDOMStack-fb

* Fix circular dependencies now that ReactDOM-fb is a GK switch

* Revert "Work around internal FB transform require() issue"

This reverts commit 0a50b6a90bffc59f8f5416ef36000b5e3a44d253.

* Bump rollup-plugin-commonjs to include a fix for rollup/rollup-plugin-commonjs#176

* Add more forwarding modules that are used on www

* Add even more forwarding modules that are used on www

* Add DOMProperty to hidden exports

* Externalize feature flags

This lets www specify them dynamically.

* Remove forwarding modules with implementations

Instead I'm adding them to react-fb in my diff.

* Add all injection necessary for error logging

* Add missing forwarding module (oops)

* Add ReactART builds

* Add ReactDOMServer bundle

* Fix UMD build of ReactDOMFiber

* Work in progress: start adding ReactNative bundle

* tidied up the options for bundles, so they can define what types they output and exclude

* Add a working RN build

* further improved and tidied up build process

* improved how bundles are built by exposing externals and making the process less "magical", also tidied up code and added more comments

* better handling of bundling ReactCurrentOwner and accessing it from renderer modules

* added NODE_DEV and NODE_PROD

* added NPM package creation and copying into build chain

* Improved UMD bundles, added better fixture testing and doc plus prod builds

* updated internal modules (WIP)

* removed all react/lib/* dependencies from appearing in bundles created on build

* added react-test-renderer bundles

* renamed bundles and paths

* fixed fixture path changes

* added extract-errors support

* added extractErrors warning

* moved shims to shims directory in rollup scripts

* changed pathing to use build rather than build/rollup

* updated release doc to reflect some rollup changes

* Updated ReactNative findNodeHandle() to handle number case (#9238)

* Add dynamic injection to ReactErrorUtils (#9246)

* Fix ReactErrorUtils injection (#9247)

* Fix Haste name

* Move files around

* More descriptive filenames

* Add missing ReactErrorUtils shim

* Tweak reactComponentExpect to make it standalone-ish in www

* Unflowify shims

* facebook-www shims now get copied over correctly to build

* removed unnecessary resolve

* building facebook-www/build is now all sync to prevent IO issues plus handles extra facebook-www src assets

* removed react-native-renderer package and made build make a react-native build dir instead

* 😭😭😭

* Add more SSR unit tests for elements and children. (#9221)

* Adding more SSR unit tests for elements and children.

* Some of my SSR tests were testing for react-text and react-empty elements that no longer exist in Fiber. Fixed the tests so that they expect correct markup in Fiber.

* Tweaked some test names after @gaearon review comment https://github.com/facebook/react/pull/9221#discussion_r107045673 . Also realized that one of the tests was essentially a direct copy of another, so deleted it.

* Responding to code review https://github.com/facebook/react/pull/9221#pullrequestreview-28996315 . Thanks @spicyj!

* ReactElementValidator uses temporary ReactNative View propTypes getter (#9256)

* Updating packages for 16.0.0-alpha.6 release

* Revert "😭😭😭"

This reverts commit 7dba33b2cfc67246881f6d57633a80e628ea05ec.

* Work around Jest issue with CurrentOwner shared state in www

* updated error codes

* splits FB into FB_DEV and FB_PROD

* Remove deps on specific builds from shims

* should no longer mangle FB_PROD output

* Added init() dev block to ReactTestUtils

* added shims for DEV only code so it does not get included in prod bundles

* added a __DEV__ wrapping code to FB_DEV

* added __DEV__ flag behind a footer/header

* Use right haste names

* keeps comments in prod

* added external babel helpers plugin

* fixed fixtures and updated cjs/umd paths

* Fixes Jest so it run tests correctly

* fixed an issue with stubbed modules not properly being replaced due to greedy replacement

* added a WIP solution for ReactCurrentOwner on FB DEV

* adds a FB_TEST bundle

* allows both ReactCurrentOwner and react/lib/ReactCurrentOwner

* adds -test to provides module name

* Remove TEST env

* Ensure requires stay at the top

* added basic mangle support (disbaled by default)

* per bundle property mangling added

* moved around plugin order to try and fix deadcode requires as per https://github.com/rollup/rollup/issues/855

* Fix flow issues

* removed gulp and grunt and moved tasks to standalone node script

* configured circleci to use new paths

* Fix lint

* removed gulp-extract-errors

* added test_build.sh back in

* added missing newline to flow.js

* fixed test coverage command

* changed permissions on test_build.sh

* fixed test_html_generations.sh

* temp removed html render test

* removed the warning output from test_build, the build should do this instead

* fixed test_build

* fixed broken npm script

* Remove unused ViewportMetrics shim

* better error output

* updated circleci to node 7 for async/await

* Fixes

* removed coverage test from circleci run

* circleci run tets

* removed build from circlci

* made a dedicated jest script in a new process

* moved order around of circlci tasks

* changing path to jest in more circleci tests

* re-enabled code coverage

* Add file header to prod bundles

* Remove react-dom/server.js (WIP: decide on the plan)

* Only UMD bundles need version header

* Merge with master

* disabled const evaluation by uglify for <script></script> string literal

* deal with ART modules for UMD bundles

* improved how bundle output gets printed

* fixed filesize difference reporting

* added filesize dep

* Update yarn lockfile for some reason

* now compares against the last run branch built on

* added react-dom-server

* removed un-needed comment

* results only get saved on full builds

* moved the rollup sized plugin into a plugins directory

* added a missing commonjs()

* fixed missing ignore

* Hack around to fix RN bundle

* Partially fix RN bundles

* added react-art bundle and a fixture for it

* Point UMD bundle to Fiber and add EventPluginHub to exported internals

* Make it build on Node 4

* fixed eslint error with resolve being defined in outer scope

* Tweak how build results are calculated and stored

* Tweak fixtures build to work on Node 4

* Include LICENSE/PATENTS and fix up package.json files

* Add Node bundle for react-test-renderer

* Revert "Hack around to fix RN bundle"

We'll do this later.

This reverts commit 59445a625962d7be4c7c3e98defc8a31f8761ec1.

* Revert more RN changes

We'll do them separately later

* Revert more unintentional changes

* Revert changes to error codes

* Add accidentally deleted RN externals

* added RN_DEV/RN_PROD bundles

* fixed typo where RN_DEV and RN_PROD were the wrong way around

* Delete/ignore fixture build outputs

* Format scripts/ with Prettier

* tidied up the Rollup build process and split functions into various different files to improve readability

* Copy folder before files

* updated yarn.lock

* updated results and yarn dependencies to the latest versions
2017-04-05 16:47:29 +01:00
Ben Alpert
19c2649e02 Use fiber by default (#9155)
Affects our builds. But not in tests yet.
2017-03-10 17:06:02 -08:00
Sasha Aickin
fcf41e7ca2 Add async/await to unit tests; modify server rendering tests to use async/await. (#9089) 2017-03-03 10:34:14 -08:00
Sebastian Markbåge
13e05b4237 Use separate feature flag for ReactTestRenderer (#8965)
The ReactDOMFeatureFlags is not reachable from the npm package since it is
in a separate build so we need a separate one.
2017-02-09 16:00:59 +00:00
Brian Vaughn
ab757e905c Fixed ReactNativeFiber event handling regression (#8959)
* Fixed ReactNativeFiber event system regression introduced in b354db2
Also added test coverage to ReactNativeEvents-test for Fiber

* ReactNative tests now run against fiber renderer when env flag set
Updated the test-framework-setup file so that record-tests runs native tests against ReactNativeFiber. ReactComponentTreeHook native tests all now fail but that's expected.

* Avoid calling setChildren() if no children
2017-02-08 21:28:56 -10:00
Andrew Clark
c0e5df66ec Make disableNewFiberFeatures = true the default when runnings tests
This exposed a few more cases that I missed.
2017-01-25 11:52:48 -08:00
Brian Vaughn
be0de3455b Log all Fiber errors w/ component stack (#8756)
A new module has been added (ReactFiberErrorLogger). This logs error information (call stack and component stack) to the console to make errors easier to debug. It also prompts users to use error boundaries if they are not already using them.

In the future, perhaps this will be injectable, enabling users to provide their own handler for custom processing/logging. For the time being, this should help with issues like this / #2461.
2017-01-13 14:45:56 -08:00
俞火江
e240470cf1 fix failed tests on Windows #8737 (#8747)
* fix failed tests on Windows #8737

* Use regexp literal instead of `RegExp` constructor so that we don't need to bother with escaping special character like `\` and `.`.
Note that by removing the path separator in regexp, I've relaxed the matching condition a little.Since there's little chance we have files like `XXXReact.d.ts`,it should not matter.
2017-01-12 06:46:23 -08:00
Brian Vaughn
b209804cfb Jest preprocessor better aware of error-codes/codes.json WRT caching 2016-12-21 16:58:33 -08:00
Dan Abramov
a27e4f3361 [Fiber] Make requestIdleCallback() and requestAnimationFrame() shims async (#8591)
* Add a failing test for recursion check

* Make requestIdleCallback() and requestAnimationFrame() shims async

They no longer need to be sync in tests because we already made DOM renderer sync by default.
This fixes a crash when testing incrementalness in DOM renderer itself.

* Style fix

* Fix lint
2016-12-21 14:04:05 -08:00
Ben Alpert
64cba04bf9 Build infra for tracking dev-specific failures (#8228)
I'll plan to change all of our console.error and component-tree expects to expectDev. It's a little annoying that we need to make sure tests don't throw (see my change to normalizeCodeLocInfo) but any alternative would seem to require two separate test runs or a much more cumbersome syntax.
2016-11-13 14:00:07 -08:00
Ben Alpert
08b4cc53b8 Track passing/failing tests in fiber (#8169)
* Work around jest toEqual bug in ReactTreeTraversal

![image](https://cloud.githubusercontent.com/assets/6820/19879640/1cd7595a-9fb2-11e6-94ac-8c38bdfc90d3.png)

* Track passing/failing tests in fiber

Run scripts/fiber/record-tests to re-record, then check git diff to see what you changed.
2016-10-31 23:26:38 -07:00
Christopher Chedeau
1a113a15c9 Update to jest 15
Jest 15 has just been released and is way more awesome: http://facebook.github.io/jest/blog/2016/09/01/jest-15.html

This pull request updates jest from version 12 to 15. Right now there's a fix in jest around Symbol that hasn't been released yet, so this will break CI and cannot be merged it. But once it ships by the end of the day, we'll be good to go :)

See comments inline for all the changes I've done.
2016-08-31 18:25:03 -07:00
Sebastian Markbåge
c06a68a10b Mock ReactDOM for Fiber Tests (#7206)
We currently write all our tests against the DOM implementation.
I need a way to run the Fiber tests against it. But I don't want
to take on any package dependencies on Fiber modules yet.

There's a problem with jest right now where you can't globally
mock modules that already exist. So I have to add a global call
to jest.mock.

Luckily we already have a way to test the useCreateElement paths
using a feature flag. I won't activate this flag in travis until
it passes, but the idea is to run all three variants in travis.

I'm not sure that invoking rAF and rIC synchronously is the best
way to test this since it doesn't capture the backwards
compatibility aspect. I.e. the fact that people might be relying
on the synchronous nature in real apps too. It's a start.

Ideally, jest would have these built-in.
2016-08-10 17:44:36 -07:00
Keyan Zhang
1abce1630c Add reactProdInvariant and corresponding babel rewrite pass (#6948) 2016-06-07 17:11:04 -07:00
Paul O’Shannessy
d8a0b9a662 Upgrade to jest-cli@0.9 and use Jasmine2 2016-05-25 21:48:32 +01:00
Dmitrii Abramov
efb6d80e60 match jest.d.ts by regex 2016-05-19 19:24:40 -07:00
chico
655ac0f0dd update typescript 2016-05-19 19:24:40 -07:00
Ben Alpert
6afd51061a Embed JSX filename paths relative to repo root (#6778)
Test Plan: Changed the preprocessor to log the output of babel.transform and saw

```
var _jsxFileName = 'src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js';
```

in the resulting output, instead of an absolute path.
2016-05-16 11:15:12 -07:00
Paul O’Shannessy
1573baaee8 Use Object.assign directly and inject object-assign at compile 2016-04-04 09:53:25 -07:00
Sebastian McKenzie
1365498b81 Update to Babel 6 2016-02-26 16:49:32 -08:00
cpojer
383e2f938d Update to jest-cli 0.9. 2016-02-17 13:01:14 +09:00
Paul O’Shannessy
7c52b802b4 Clean up ununsed devDeps
Also removed object-assign. We only support building with node v4+ which has Object.assign.
2016-01-22 10:17:30 -08:00
Justas Brazauskas
0886273438 Fix few typos in React docs and comments 2015-12-13 16:39:07 +02:00
Paul O’Shannessy
b5d90f8c6b Merge pull request #5331 from tbroadley/typescript-test-windows
Fix for TypeScript test on Windows
2015-10-30 15:45:51 -07:00
Thomas Broadley
d77e161f99 use path library to normalize filepath 2015-10-31 07:38:47 +09:00
Thomas Broadley
d80710b0ae fix for TypeScript test on Windows 2015-10-30 10:22:50 +09:00
Paul O’Shannessy
ad00a6e672 [lint] Make eqeqeq a failure 2015-10-27 15:39:54 -07:00
Sebastian Markbage
41cba2e77b Enforce NODE_ENV=test
You could make the argument that this should be optional, but it doesn't
work without it so we might as well just enforce it.

Makes `jest` work by default.
2015-09-30 17:43:06 -07:00
Ben Alpert
b8c7b13042 Fail jest tests on any un-spied warnings
Originally #4223 -- we lost this when we switched to jest.
2015-09-29 17:35:39 -07:00
Paul O’Shannessy
873e3a9816 Cleanup Jest preprocessor, use cache key 2015-09-23 13:46:41 -07:00
Paul O’Shannessy
2afc9a445f Upgrade to node@4, jest@0.5 2015-09-23 13:46:41 -07:00
Ben Alpert
31cb102650 Merge pull request #4762 from spicyj/ts
Make TypeScript test work with ReactDOM
2015-09-01 14:30:56 -07:00
Ben Alpert
589c8364b0 Make TypeScript test work with ReactDOM 2015-09-01 14:28:12 -07:00
Paul O’Shannessy
52b4c9eabf Upgrade to fbjs, fbjs-scripts @ 0.2 2015-08-31 17:19:42 -07:00
Ben Alpert
a8b6c8292b hax to make jest fast
Turns out jest is _incredibly_ slow at resolving require paths like `require('fbjs/lib/foo')`. Like several milliseconds per require. Really adds up when all our files require `invariant` and `warning`. Here's a temporary hack to make things fast again.

Test Plan:
```
npm test src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
```

has a self-proclaimed runtime of ~8 seconds now instead of ~35 seconds.
2015-08-18 21:40:58 -07:00
Paul O’Shannessy
ecb34de574 Upgrade ESLint, fix code 2015-08-10 17:04:29 -07:00
Paul O’Shannessy
be5c09c24d Update fbjs dependency
- remove a file that got moved over there
- update for renamed babel transform
2015-07-27 13:37:48 -07:00
Paul O’Shannessy
1d0c1b1817 Use fbjs package from npm, gulp
This reworks a few things in building and distributing React. The biggest change is using fbjs to share dependencies with other libraries. We're also using Gulp for some build steps.
2015-07-23 15:48:02 -07:00