Skip to content

Commit ea4c0aa

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular-devkit/core): throw error when project has missing root property
BREAKING CHANGE: Workspace projects with missing `root` is now an error.
1 parent d829d73 commit ea4c0aa

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Diff for: packages/angular_devkit/core/src/workspace/json/reader.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,7 @@ function parseProject(
190190

191191
const projectNodeValue = getNodeValue(projectNode);
192192
if (!('root' in projectNodeValue)) {
193-
// TODO(alan-agius4): change this to error in v15.
194-
context.warn(
195-
`Project "${projectName}" is missing a required property "root". This will become an error in the next major version.`,
196-
projectNodeValue,
197-
);
193+
throw new Error(`Project "${projectName}" is missing a required property "root".`);
198194
}
199195

200196
for (const [name, value] of Object.entries<JsonValue>(projectNodeValue)) {

Diff for: packages/angular_devkit/core/src/workspace/json/reader_spec.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,8 @@ describe('readJsonWorkpace Parsing', () => {
148148
}
149149
`);
150150

151-
const consoleWarnSpy = spyOn(console, 'warn').and.callFake(() => undefined);
152-
await expectAsync(readJsonWorkspace('', host));
153-
154-
expect(consoleWarnSpy).toHaveBeenCalledWith(
155-
`Project "foo" is missing a required property "root". This will become an error in the next major version.`,
151+
await expectAsync(readJsonWorkspace('', host)).toBeRejectedWithError(
152+
/Project "foo" is missing a required property "root"/,
156153
);
157154
});
158155
});

0 commit comments

Comments
 (0)