Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular CLI command issue: "Unknown option: '--spec'"

I am running this command:

C:\Users\Murali\my-first-app>ng g c abcde5 --dry-run -t -s --spec=false

I am receiving the following error:

Unknown option: '--spec'

How can I correct my command to avoid this?

like image 295
mahesh kadari Avatar asked Jun 06 '20 07:06

mahesh kadari


People also ask

How can you avoid Spec TS file in angular while creating component?

Run ng config schematics. @schematics/angular. component. spec false to configure spec for components.

What is the use of spec file in angular?

spec. ts file. This file contains unit tests for the main AppComponent. When running tests using the Angular CLI, all unit tests in files with the *.

What is the solution to skip generating spec test files while creating a new service file by running the NG generate command?

You have to use "--skip-tests true" when generating component. (Note: you can get the above version info by trying "ng v" or "ng -v" in the terminal). You can get the complete list of switches for "ng g c (short for ng generate component)" using "ng g c --help". Alternatively you can add a component manually.

What is dry run in angular CLI?

module. ts (3181 bytes) NOTE: The "dryRun" flag means no changes were made. As you can see I've ran a command which generates a new component.


2 Answers

You can find all options here. Answering you question replace --spec=false by --skip-tests. If it won't working please provide the AngularCLI version

like image 191
vadimk7 Avatar answered Sep 28 '22 01:09

vadimk7


You can also use --skip-tests flag to skip generating .spec files. For more detail, you can use ng g c --help, this will give you further details

like image 43
Babita Bisht Avatar answered Sep 28 '22 03:09

Babita Bisht