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

Unify noop and test renderer assertion APIs #14952

Merged
merged 2 commits into from Feb 26, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 25, 2019

The matchers will fail if you flush work while the log is empty. Makes it harder to miss unexpected
behavior by forcing you to assert on every logged value. This is the pattern we already follow for test renderer. I've used the same APIs as test renderer, so it should be easy to switch between the two.

This is a large diff but it's mostly a big find-and-replace. The most important changes are in createReactNoop and reactTestMatchers.

@sizebot
Copy link

sizebot commented Feb 25, 2019

Details of bundled changes.

Comparing: 3989c09...ce0d4bb

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js -16.0% -11.6% 32.82 KB 27.59 KB 7.45 KB 6.59 KB NODE_DEV
react-noop-renderer.production.min.js -12.5% -10.4% 11.26 KB 9.85 KB 3.68 KB 3.29 KB NODE_PROD
react-noop-renderer-persistent.development.js -15.9% -11.6% 32.94 KB 27.7 KB 7.47 KB 6.6 KB NODE_DEV
react-noop-renderer-persistent.production.min.js -12.4% -10.5% 11.28 KB 9.88 KB 3.69 KB 3.3 KB NODE_PROD
react-noop-renderer-server.development.js 0.0% -0.2% 1.83 KB 1.83 KB 877 B 875 B NODE_DEV
react-noop-renderer-server.production.min.js 0.0% -0.4% 813 B 813 B 491 B 489 B NODE_PROD

Generated by 🚫 dangerJS

Test renderer already does this. Makes it harder to miss unexpected
behavior by forcing you to assert on every logged value.
The matchers warn if work is flushed while the log is empty. This is
the pattern we already follow for test renderer. I've used the same APIs
as test renderer, so it should be easy to switch between the two.
@acdlite acdlite merged commit 8e25ed2 into facebook:master Feb 26, 2019
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
* Throw in tests if work is done before emptying log

Test renderer already does this. Makes it harder to miss unexpected
behavior by forcing you to assert on every logged value.

* Convert ReactNoop tests to use jest matchers

The matchers warn if work is flushed while the log is empty. This is
the pattern we already follow for test renderer. I've used the same APIs
as test renderer, so it should be easy to switch between the two.
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.

None yet

4 participants