https://github.com/angular/angular
Revision d2ae96f742c82daa6c4d4b8afd3b0959fb9b89d1 authored by Douglas Parker on 19 January 2022, 18:37:54 UTC, committed by Andrew Kushnir on 21 January 2022, 19:20:48 UTC
Previously, if a bad extended diagnostic category was given, it would fail with the expected error as well as an unexpected assertion error:

```
$ ng build -c development
✔ Browser application bundle generation complete.

./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Unexpected call to 'assertNever()' with value:
test
    at /home/douglasparker/Source/ng-new/node_modules/@ngtools/webpack/src/ivy/loader.js:77:18
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Unexpected call to 'assertNever()' with value:
test
    at /home/douglasparker/Source/ng-new/node_modules/@ngtools/webpack/src/ivy/loader.js:77:18
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Error: error NG4004: Angular compiler option "extendedDiagnostics.checks['invalidBananaInBox']" has an unknown diagnostic category: "test".

Allowed diagnostic categories are:
warning
error
suppress
```

The assertion comes from `ExtendedTemplateCheckerImpl`, which expects a well-formed configuration, yet the compiler would construct it even when errors were found. This commit skips constructing and running extended diagnostics if the configuration had errors, which should avoid triggering these assertion errors.

I'm unfortunately not able to actually test this change. The test passes even before the fix because the `ngc` binary and end-to-end tests [don't request diagnostics unless the configuration is considered valid](https://github.com/angular/angular/blob/ed21f5c75378e1ce717ee3d76d28c8c994209de1/packages/compiler-cli/src/perform_compile.ts#L292-L293). See [Slack](https://angular-team.slack.com/archives/C4WHZQMRA/p1642641305003800) for more details.

PR Close #44778
1 parent 5626b34
History
Tip revision: d2ae96f742c82daa6c4d4b8afd3b0959fb9b89d1 authored by Douglas Parker on 19 January 2022, 18:37:54 UTC
fix(compiler-cli): skip `ExtendedTemplateCheckerImpl` construction if there were configuration errors (#44778)
Tip revision: d2ae96f
File Mode Size
.circleci
.devcontainer
.github
.husky
.ng-dev
.vscode
.yarn
aio
docs
goldens
integration
modules
packages
scripts
third_party
tools
.bazelignore -rw-r--r-- 2.8 KB
.bazelrc -rw-r--r-- 6.7 KB
.bazelversion -rw-r--r-- 6 bytes
.clang-format -rw-r--r-- 73 bytes
.editorconfig -rw-r--r-- 245 bytes
.gitattributes -rw-r--r-- 240 bytes
.gitignore -rw-r--r-- 797 bytes
.gitmessage -rw-r--r-- 7.2 KB
.mailmap -rw-r--r-- 51 bytes
.npmrc -rw-r--r-- 21 bytes
.nvmrc -rw-r--r-- 8 bytes
.prettierrc -rw-r--r-- 157 bytes
.pullapprove.yml -rw-r--r-- 47.7 KB
.yarnrc -rw-r--r-- 130 bytes
BUILD.bazel -rw-r--r-- 2.0 KB
CHANGELOG.md -rw-r--r-- 983.5 KB
CODE_OF_CONDUCT.md -rw-r--r-- 1.1 KB
CONTRIBUTING.md -rw-r--r-- 15.8 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 4.7 KB
WORKSPACE -rw-r--r-- 2.8 KB
browser-providers.conf.js -rw-r--r-- 1.8 KB
gulpfile.js -rw-r--r-- 631 bytes
karma-js.conf.js -rw-r--r-- 6.0 KB
package.json -rw-r--r-- 8.4 KB
renovate.json -rw-r--r-- 2.5 KB
test-events.js -rw-r--r-- 259 bytes
tsconfig-tslint.json -rw-r--r-- 149 bytes
tslint.json -rw-r--r-- 4.9 KB
yarn.lock -rw-r--r-- 649.0 KB
yarn.lock.readme.md -rw-r--r-- 1.3 KB

README.md

back to top