nx icon indicating copy to clipboard operation
nx copied to clipboard

Better @nrwl/nx-plugin testing utils

Open ZachJW34 opened this issue 2 years ago • 2 comments

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 CIinvokes npm 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.

ZachJW34 avatar Jul 02 '22 14:07 ZachJW34

This is rather unpleasant, everything is there, but you cant use it for testing your plugins 😞

jkavalec avatar Sep 22 '22 10:09 jkavalec

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! 🙏

github-actions[bot] avatar May 31 '23 00:05 github-actions[bot]

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.

Bielik20 avatar Sep 12 '23 09:09 Bielik20

Hope this issue will be resolved, i need many functions from nx e2e testing like runNxCommandUntil.

khalilou88 avatar Sep 25 '23 10:09 khalilou88

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.

FrozenPandaz avatar May 13 '24 21:05 FrozenPandaz

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.

github-actions[bot] avatar Jun 14 '24 00:06 github-actions[bot]