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

Allow custom suffix when generating unit tests #1683

Closed
1 task done
garritfra opened this issue Jun 17, 2022 · 9 comments
Closed
1 task done

Allow custom suffix when generating unit tests #1683

garritfra opened this issue Jun 17, 2022 · 9 comments
Labels

Comments

@garritfra
Copy link

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

We've settled with .test.ts as a unit-test suffix for all of our projects. While Nest is able to interpret these files, it can only produce .spec.ts files when generating a resource, which breaks our convention. It would be nice to be able to specify a custom suffix as a cli option.

Describe the solution you'd like

There should be a cli flag and config option to specify the suffix to be used, with the default being spec.

nest g res foo --spec-suffix=test

nest-cli.json:

{
	"generateOptions": {
		"spec": true,
		"specSuffix": "test"
	}
}

(flag and option naming TBD.)

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Implementing this feature makes it easier to adopt company conventions.

@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

@garritfra
Copy link
Author

@kamilmysliwiec I'll see what I can do.👍

@garritfra
Copy link
Author

@kamilmysliwiec implementing this takes longer than I anticipated. To prepare for this change, I opened a draft PR in the schematics repo (nestjs/schematics#1077). Let me know if I'm taking a wrong route. Otherwise, I'll gradually finish that PR and then finish the work up here.

@kamilmysliwiec
Copy link
Member

Thanks @garritfra, let's track this here nestjs/schematics#1077!

@hrkeni
Copy link

hrkeni commented Mar 9, 2023

@kamilmysliwiec Does this need to be reopened? I don't believe the feature has been implemented and didn't make it into the cli as part of nestjs/schematics#1077

@garritfra Am I seeing that correctly?

@garritfra
Copy link
Author

@hrkeni yes, that's correct. I don't have the time to work on it anymore, but it should be a simple change.

@hrkeni
Copy link

hrkeni commented Mar 10, 2023

I would be happy to work on this.

@hrkeni
Copy link

hrkeni commented Mar 26, 2023

@kamilmysliwiec Please reopen this issue and review PRs or let me know if I should open another issue here. Thank you.

@hrkeni
Copy link

hrkeni commented Mar 28, 2023

@micalevisk Apologies for the spam. Can you take a look at the comments above and advise?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants