Skip to content

Commit

Permalink
fix(@angular-devkit/core): throw error when project has missing root …
Browse files Browse the repository at this point in the history
…property

BREAKING CHANGE: Workspace projects with missing `root` is now an error.
  • Loading branch information
alan-agius4 authored and clydin committed Sep 21, 2022
1 parent d829d73 commit ea4c0aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
6 changes: 1 addition & 5 deletions packages/angular_devkit/core/src/workspace/json/reader.ts
Expand Up @@ -190,11 +190,7 @@ function parseProject(

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

for (const [name, value] of Object.entries<JsonValue>(projectNodeValue)) {
Expand Down
Expand Up @@ -148,11 +148,8 @@ describe('readJsonWorkpace Parsing', () => {
}
`);

const consoleWarnSpy = spyOn(console, 'warn').and.callFake(() => undefined);
await expectAsync(readJsonWorkspace('', host));

expect(consoleWarnSpy).toHaveBeenCalledWith(
`Project "foo" is missing a required property "root". This will become an error in the next major version.`,
await expectAsync(readJsonWorkspace('', host)).toBeRejectedWithError(
/Project "foo" is missing a required property "root"/,
);
});
});
Expand Down

0 comments on commit ea4c0aa

Please sign in to comment.