The expected behavior when creating a new component using angular-cli is that angular.json.projects is updated with an entry describing the newly created component. The observed behavior is that angular-cli does not do so.
I found this out after running ng test newComponent and receiving the message Project 'inline' does not support the 'test' target.
The ng test newComponent worked after I updated angular.json.projects to describe the newly created component.
I'm migrating an Angular 2 component library to the new Angular 7 Workspace model. I'm building it from scratch using Todd Palmer's The Angular Library Series - Creating a Library with Angular CLI recipe.
Although the recipe does not recommend testing a newly created component, I did and observed the failure herein described.
Steps to reproduce
- using [email protected] create a library workspace
ng new workspace --create-application=false
- Create a library
ng generate library library --prefix=abc
- Create a testing application, I call it a living style guide
ng generate application living-style-guide
- Create a new library component
ng generate component newComponent —project=library
- Validate the component creation
ng test newComponent —project=library
Observed Behavior The last command fails with the following message
Project 'newComponent' does not support the 'test' target.
Error: Project 'newComponent' does not support the 'test' target.
at TestCommand.initialize (./node_modules/@angular/cli/models/architect-command.js:53:19)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Expected Behavior angular-cli updates angular.json projects object with a description of newly created library components and their unit tests pass.