File tree 2 files changed +21
-0
lines changed
packages/angular_devkit/core/src/workspace/json
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,12 @@ function parseProject(
167
167
}
168
168
169
169
const projectNodeValue = getNodeValue ( projectNode ) ;
170
+ if ( ! ( 'root' in projectNodeValue ) ) {
171
+ context . error (
172
+ `Project "${ projectName } " is missing a required property "root".` ,
173
+ projectNodeValue ,
174
+ ) ;
175
+ }
170
176
171
177
for ( const [ name , value ] of Object . entries < JsonValue > ( projectNodeValue ) ) {
172
178
switch ( name ) {
Original file line number Diff line number Diff line change @@ -137,6 +137,21 @@ describe('readJsonWorkpace Parsing', () => {
137
137
/ v e r s i o n s p e c i f i e r n o t f o u n d / ,
138
138
) ;
139
139
} ) ;
140
+
141
+ it ( 'errors on missing root property in a project' , async ( ) => {
142
+ const host = createTestHost ( stripIndent `
143
+ {
144
+ "version": 1,
145
+ "projects": {
146
+ "foo": {}
147
+ }
148
+ }
149
+ ` ) ;
150
+
151
+ await expectAsync ( readJsonWorkspace ( '' , host ) ) . toBeRejectedWithError (
152
+ / P r o j e c t " f o o " i s m i s s i n g a r e q u i r e d p r o p e r t y " r o o t " / ,
153
+ ) ;
154
+ } ) ;
140
155
} ) ;
141
156
142
157
describe ( 'JSON WorkspaceDefinition Tracks Workspace Changes' , ( ) => {
You can’t perform that action at this time.
0 commit comments