liferay / liferay-npm-tools

Collection of tools for using npm in Liferay
Other
18 stars 15 forks source link

feat(scripts): add testing-library/react-hooks #499

Closed wincent closed 4 years ago

wincent commented 4 years ago

We were using v1.0.4 unofficially in liferay-portal due to this devDependency.

We want to make it official and integrate it into liferay-portal "The Right Way™", which means bring it into liferay-npm-scripts. The question is, which version? The latest release is in the v3 range, which means there have been two breaking changes.

In this commit, we try out the latest and we'll see what breaks. During the install yarn prints:

warning " > @testing-library/react-hooks@3.4.1" has unmet peer dependency "react@>=16.9.0".
warning " > @testing-library/react-hooks@3.4.1" has unmet peer dependency "react-test-renderer@>=16.9.0".

First one is ok because we'll get that from the copy hoisted from frontend-js-react-web in liferay-portal anyway (we have a very loose requirement specified in liferay-npm-scripts' package.json so that we don't wind up pulling in another version by mistake).

Second will be ok too because I am adding it as an explicit dep; again with a loose version requirement because we want yarn to have maximum flexibility to resolve the dependency to a single, unique version.

Test plan:

  1. yarn add this in liferay-portal.
  2. Grab https://github.com/liferay-frontend/liferay-portal/pull/384 and edit it; see that tests still work.

Closes: https://github.com/liferay/liferay-npm-tools/issues/496

wincent commented 4 years ago

Still carrying out the test plan. I'll report back here with the results.

wincent commented 4 years ago

Testing in liferay-portal:

portal-workflow-metrics-web

Test Suites: 72 passed, 72 total
Tests:       259 passed, 259 total
Snapshots:   0 total
Time:        25.586s
Ran all test suites.
✨  Done in 28.52s.

These tests have huge amounts of console spew, although they all pass. I think the team should try to address that, and if they need help Frontend Infra can provide it; but it's not a blocker for any of these PRs.

layout-content-page-editor-web

Test Suites: 46 passed, 46 total
Tests:       1 todo, 227 passed, 228 total
Snapshots:   0 total
Time:        25.392s
Ran all test suites.
✨  Done in 28.35s.
wincent commented 4 years ago

Shipping this on the ground that it is #NoLogicChanges and I tested it. 😀