-
Notifications
You must be signed in to change notification settings - Fork 667
Add plugin extension tests #1708
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
Add plugin extension tests #1708
Conversation
|
@vojtechszocs: GitHub didn't allow me to request PR reviews from the following users: jelkosz. Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
As a follow-up, I'd like to replace all Alternatively, we can retain the existing |
Just to be clear, we'd be able to use |
|
Great to see these additional tests 👍 /approve |
Yes 😃 AFAIK we still need to use The Also, if you can think of any additional extension tests that we should perform, let me know and I'll add them. The more issues with plugins we can check during test/build time (instead of runtime), the better. |
|
@spadgett To ensure this doesn't have unexpected impact on build outputs, I'll run |
Hmm, it seems like So I've compared
Generated chunk sizes were equivalent. The |
|
Please note, this PR isn't complete without its follow-up #1724 which removes |
|
@christianvogt It might be better for you to review if you have bandwidth |
Yes, this PR alone should pass tests and the webpack build output should be the same as before, effectively using #1724 completes this PR in terms of Lodash imports used within the code & ESLint configuration, but this has no impact on webpack output. |
d52ff2d to
23b21fd
Compare
|
Rebased & included config tweaks from #1724
'no-restricted-imports': [
'error',
{
name: 'lodash-es',
- message: 'Use lodash instead.',
+ message: 'Use lodash instead. webpack is configured to use lodash-es automatically.',
},
],
- new webpack.NormalModuleReplacementPlugin(/^lodash$/, 'lodash-es'),
+ // replace 'lodash' and 'lodash/*' imports with a lodash-es equivalent
+ new webpack.NormalModuleReplacementPlugin(/^lodash($|\/.*$)/, (resource) => {
+ resource.request = resource.request.replace(/^lodash/, 'lodash-es');
+ }), |
|
Need to rebase on top of #1743, one more update incoming. |
23b21fd to
1a1af6e
Compare
Done, please review the second commit titled |
|
#1724 rebased & updated, please review if you have some spare time 😃 |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, spadgett, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@vojtechszocs , With #1708 merged, recent master fails to open vms list from Edit: |
I'm looking into this. |
|
@mareklibra #1766 should fix the problem you've encountered. |
This PR aims to improve the overall quality of Console plugins by detecting common problems at build time, using Jest as the test platform.
In the above screenshot,
metal3-pluginwas modified to addVirtualMachineModelwhich is already contributed bykubevirt-plugin. The object diff reflects the expectation ofduplicateModelsbeing[].Tests under
packages/console-app/src/__tests__/extension-checkswork with the same set of active plugins as the webpack build. This ensures consistency between plugins getting tested vs. plugins getting bundled in the Console build output.Summary of changes
testRegexnow matches files withspec.(ts|tsx|js|jsx)suffix, allowing developers to put test utility modules under__tests__directories@types/jestdev dependency along with correspondingtsconfig.jsonupdatepackagesnow useslodashinstead oflodash-eswebpack.NormalModuleReplacementPluginto replacelodashwithlodash-esNavItem,YAMLTemplate)Consequently, production code that interprets Console extensions is simplified, i.e. no need to report on conflicting models or similar problems.
The demo plugin was updated so that extension tests pass when this plugin is enabled.
⭐ What's the deal with
lodashvs.lodash-esanyway?lodash-esis a variation of thelodashlibrary which uses ECMAScript module syntax.Most tools, including
ts-nodeand Jest, expect code under thenode_modulesdirectory to be transpiled and ready for use. Using libraries likelodash-esin environments like Node.js LTS results in syntax errors. Consoleintegration-tests, for example, uselodashexactly because of this (Protractor not configured to transpilenode_modules/lodash-es, as opposed to Jest).To be able to dynamically load Console plugin entry points in context of Node.js env. (Jest), we have to use
lodashinstead oflodash-es. To retain current approach of usinglodash-esin the webpack build, we useNormalModuleReplacementPlugin. This allows us to remove thelodashvs.lodash-esduality./cc @spadgett @alecmerdler @christianvogt @jelkosz