nx
nx copied to clipboard
Better @nrwl/nx-plugin testing utils
Description
Hey nrwl team! I'm the author of the nx-plus plugins
The utils provided from @nrwl/nx-plugin
for testing purposes work pretty well but I've noticed a few things:
- There is no option for providing what package manager to use when invoking cli commands. I use
yarn
in my repo but CIinvokesnpm
when scaffolding tmp projects. - I have to strip ansii colors from command output
It seems like all of these problems have been solved by the internal tooling located in e2e/utils. It would be great if either the nx-plugin
package was updated or these utils were published instead. The code in both locations looks the same, so a good chance to remove some duplication.
Motivation
Make it easier for plugin authors to e2e test their plugins
Suggested Implementation
Update @nrwl/nx-plugin/testing
to have the same API as e2e/utils
. It would be nice as a plugin author to use the same API used internally to test plugins.
Alternate Implementations
Either reuse the same code in both locations or do a good ol copy and paste if the team wants to keep their e2e utils internal.
This is rather unpleasant, everything is there, but you cant use it for testing your plugins 😞
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Coming from https://github.com/nrwl/nx/issues/4851 (as it is closed) To anyone interested I decided to share my PR using newly added verdaccio to handle multiple dependant projects in e2e: https://github.com/Bielik20/nx-plugins/pull/98
It is mostly basen on the code generated by Nx (when creating new plugin with e2e tests) but I have adjusted it to not publish every package in repository, only the dependant ones and to work with classic methods from @nrwl/nx-plugin/testing
etc. It is still a bit slower than the previous setup but closer to the end user experience so I think it is worth it.
Note: I do not maintain
@ns3/nx-core
under semantic release. It is mostly a bunch of features for other packages I have in this repository so I recommend copying code from@ns3/nx-core
instead of installing it.
Hope this issue will be resolved, i need many functions from nx e2e testing
like runNxCommandUntil
.
Our e2e testing strategy for plugins has changed quite a bit since we released the verdaccio support.
If you want any e2e testing utils, please create a new issue for the specific util you would like.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.