-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
Run Jest in production mode #11616
Run Jest in production mode #11616
Commits on Nov 21, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 71469e6 - Browse repository at this point
Copy the full SHA 71469e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for d97968f - Browse repository at this point
Copy the full SHA d97968fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c7438a - Browse repository at this point
Copy the full SHA 3c7438aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e6ce26 - Browse repository at this point
Copy the full SHA 6e6ce26View commit details -
It fails because the config is now passed to Jest explicitly. But the test doesn't know about the config. To fix this, we just run it via `yarn test` (which includes the config). We already depend on Yarn for development anyway.
Configuration menu - View commit details
-
Copy full SHA for d751fe5 - Browse repository at this point
Copy the full SHA d751fe5View commit details -
Configuration menu - View commit details
-
Copy full SHA for f43aaf5 - Browse repository at this point
Copy the full SHA f43aaf5View commit details -
Actually flip the production tests to run in prod environment
This produces a bunch of errors: Test Suites: 64 failed, 58 passed, 122 total Tests: 740 failed, 26 skipped, 1809 passed, 2575 total Snapshots: 16 failed, 4 passed, 20 total
Configuration menu - View commit details
-
Copy full SHA for 991e359 - Browse repository at this point
Copy the full SHA 991e359View commit details -
Ignore expectDev() calls in production
Down from 740 to 175 failed. Test Suites: 44 failed, 78 passed, 122 total Tests: 175 failed, 26 skipped, 2374 passed, 2575 total Snapshots: 16 failed, 4 passed, 20 total
Configuration menu - View commit details
-
Copy full SHA for ae39a60 - Browse repository at this point
Copy the full SHA ae39a60View commit details -
Decode errors so tests can assert on their messages
Down from 175 to 129. Test Suites: 33 failed, 89 passed, 122 total Tests: 129 failed, 1029 skipped, 1417 passed, 2575 total Snapshots: 16 failed, 4 passed, 20 total
Configuration menu - View commit details
-
Copy full SHA for 8325c6d - Browse repository at this point
Copy the full SHA 8325c6dView commit details -
Remove ReactDOMProduction-test
There is no need for it now. The only test that was special is moved into ReactDOM-test.
Configuration menu - View commit details
-
Copy full SHA for b8b136b - Browse repository at this point
Copy the full SHA b8b136bView commit details -
Remove production switches from ReactErrorUtils
The tests now run in production in a separate pass.
Configuration menu - View commit details
-
Copy full SHA for cabddb7 - Browse repository at this point
Copy the full SHA cabddb7View commit details -
Add and use spyOnDev() for warnings
This ensures that by default we expect no warnings in production bundles. If the warning *is* expected, use the regular spyOn() method. This currently breaks all expectDev() assertions without __DEV__ blocks so we go back to: Test Suites: 56 failed, 65 passed, 121 total Tests: 379 failed, 1029 skipped, 1148 passed, 2556 total Snapshots: 16 failed, 4 passed, 20 total
Configuration menu - View commit details
-
Copy full SHA for bc3027f - Browse repository at this point
Copy the full SHA bc3027fView commit details -
Replace expectDev() with expect() in __DEV__ blocks
We started using spyOnDev() for console warnings to ensure we don't *expect* them to occur in production. As a consequence, expectDev() assertions on console.error.calls fail because console.error.calls doesn't exist. This is actually good because it would help catch accidental warnings in production. To solve this, we are getting rid of expectDev() altogether, and instead introduce explicit expectation branches. We'd need them anyway for testing intentional behavior differences. This commit replaces all expectDev() calls with expect() calls in __DEV__ blocks. It also removes a few unnecessary expect() checks that no warnings were produced (by also removing the corresponding spyOnDev() calls). Some DEV-only assertions used plain expect(). Those were also moved into __DEV__ blocks. ReactFiberErrorLogger was special because it console.error()'s in production too. So in that case I intentionally used spyOn() instead of spyOnDev(), and added extra assertions. This gets us down to: Test Suites: 21 failed, 100 passed, 121 total Tests: 72 failed, 26 skipped, 2458 passed, 2556 total Snapshots: 16 failed, 4 passed, 20 total
Configuration menu - View commit details
-
Copy full SHA for 22e0158 - Browse repository at this point
Copy the full SHA 22e0158View commit details -
Enable User Timing API for production testing
We could've disabled it, but seems like a good idea to test since we use it at FB.
Configuration menu - View commit details
-
Copy full SHA for efa46d3 - Browse repository at this point
Copy the full SHA efa46d3View commit details -
Test for explicit Object.freeze() differences between PROD and DEV
This is one of the few places where DEV and PROD behavior differs for performance reasons. Now we explicitly test both branches.
Configuration menu - View commit details
-
Copy full SHA for 6e34120 - Browse repository at this point
Copy the full SHA 6e34120View commit details
Commits on Nov 22, 2017
-
Configuration menu - View commit details
-
Copy full SHA for 871f2d8 - Browse repository at this point
Copy the full SHA 871f2d8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0d2bca8 - Browse repository at this point
Copy the full SHA 0d2bca8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ab3775 - Browse repository at this point
Copy the full SHA 5ab3775View commit details -
This logic is really complicated because of the global ReactFiberErrorLogger mock. I understand it now, so I added TODOs for later. It can be much simpler if we change the rest of the tests that assert uncaught errors to also assert they are logged as warnings. Which mirrors what happens in practice anyway.
Configuration menu - View commit details
-
Copy full SHA for 623becd - Browse repository at this point
Copy the full SHA 623becdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 50be63d - Browse repository at this point
Copy the full SHA 50be63dView commit details -
Change tests to document the DEV/PROD difference for state invariant
It is very likely unintentional but I don't want to change behavior in this PR. Filed a follow up as facebook#11618.
Configuration menu - View commit details
-
Copy full SHA for 9208e42 - Browse repository at this point
Copy the full SHA 9208e42View commit details -
Configuration menu - View commit details
-
Copy full SHA for 32dccc4 - Browse repository at this point
Copy the full SHA 32dccc4View commit details -
Configuration menu - View commit details
-
Copy full SHA for efc409d - Browse repository at this point
Copy the full SHA efc409dView commit details -
Configuration menu - View commit details
-
Copy full SHA for cfdf0fc - Browse repository at this point
Copy the full SHA cfdf0fcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b253ff - Browse repository at this point
Copy the full SHA 7b253ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4fe3b85 - Browse repository at this point
Copy the full SHA 4fe3b85View commit details -
Configuration menu - View commit details
-
Copy full SHA for 60212f2 - Browse repository at this point
Copy the full SHA 60212f2View commit details -
Configuration menu - View commit details
-
Copy full SHA for b5263d6 - Browse repository at this point
Copy the full SHA b5263d6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 271aff0 - Browse repository at this point
Copy the full SHA 271aff0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b40873 - Browse repository at this point
Copy the full SHA 5b40873View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1821d1a - Browse repository at this point
Copy the full SHA 1821d1aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8ebc499 - Browse repository at this point
Copy the full SHA 8ebc499View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6758f4c - Browse repository at this point
Copy the full SHA 6758f4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 16d77e8 - Browse repository at this point
Copy the full SHA 16d77e8View commit details -
We used to before, too. I just forgot to add the arguments after deleting the script.
Configuration menu - View commit details
-
Copy full SHA for 66e4457 - Browse repository at this point
Copy the full SHA 66e4457View commit details