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

Never overwrite unit or integration tests automatically #23211

Closed
1 task done
Semo opened this issue Aug 18, 2023 · 2 comments
Closed
1 task done

Never overwrite unit or integration tests automatically #23211

Semo opened this issue Aug 18, 2023 · 2 comments

Comments

@Semo
Copy link

Semo commented Aug 18, 2023

Stop overwriting unit tests or integration tests when e.g. running a JDL with jhipster generator. Even if the user selects "force" option, just don't allow overwriting tests.

Motivation

After a JDL file has been updated and executed in the jhipster generator, there will be a number of changes in the entire project. It has turned out, that when a file needs to be overwritten, it is easier to let the generator do its job rather than individually agreeing or denying. Otherwise, problems arise when rejecting the change, if you accidentally agree when you would have been better off rejecting it. This problem arises, when you have a large number of files that need to be accepted or rejected one at a time, making it easier to have everything overwritten.

But the fundamental problem with this is that all unit and integration tests are then mercilessly overwritten.

This is a very bad strategy IMHO, since developers don't have a chance to check the completion of customer tasks afterwards. Unless developers go to the repository to correct the files manually, which is laborious and very time-consuming.

That's why I suggest implementing a protection mechanism that automatically prevents the overwriting of units or integration tests as long as the user does not specify a flag/switch/whatever in the command.

Why is it important?

Having unit and integration tests is the only way to find out, if the frontend/backend will fulfil already solved issues/feature requests of an application.

  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Aug 18, 2023

We recommend committing your project to Git before running any JHipster commands. That way, you can always roll back if files are overwritten or deleted by mistake.

@mshima
Copy link
Member

mshima commented Aug 18, 2023

We have .yo-resolve for that.
echo src/test/java/** >> .yo-resolve

More tips https://www.jhipster.tech/tips/035_tip_combine_generation_and_custom_code.html

@mshima mshima closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2023
@deepu105 deepu105 added this to the 8.0.0-beta.3 milestone Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants