Skip to content

Allow custom suffix when generating unit tests #1683

@garritfra

Description

@garritfra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions