angular/packages/compiler-cli/test
Paul Gschwendtner 6c1573bc08 fix(compiler-cli): downlevel transform incorrectly extracting constructor parameters for nested classes (#44281)
The downlevel decorator transform (commonly used in the CLI and other
tooling of the ecosystem for enabling JIT ES2015+), is currently
incorrectly dealing with nested classes.

The transform will accidentally visit nested classes (in a constructor)
multiple times and generate duplicated instances of the `ctorParameters`
fields. This does not sound like an issue at first, but the duplicated
`ctorParameters` fields will miss significant type information that has
been elided by the first visit, resulting in generated code like the
following:

```js
      let MyClass = /* @__PURE__ */ __name(class MyClass extends UpgradeNg1ComponentAdapter {
        constructor(scope, injector3, elementRef) {
        }
      }, "MyClass");
      MyClass.ctorParameters = () => [
        { type: void 0, decorators: [{ type: Inject, args: [$SCOPE] }] },
        { type: Injector },
        { type: ElementRef }
      ];
      MyClass.ctorParameters = () => [
        { type: void 0 }, // <---- NOTE!
        { type: Injector },
        { type: ElementRef }
      ];
```

PR Close #44281
2021-11-30 11:56:05 -05:00
..
compliance fix(compiler): ensure that partially compiled queries can handle forward references (#44113) 2021-11-10 18:25:16 +00:00
diagnostics test: remove view-engine-only tests (#43884) 2021-11-23 21:10:06 +00:00
metadata refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
ngtsc refactor(compiler-cli): remove Ivy switch transform (#43891) 2021-11-24 19:26:25 +00:00
BUILD.bazel test: re-add downlevel decorator transform test (#44281) 2021-11-30 11:56:05 -05:00
downlevel_decorators_transform_spec.ts fix(compiler-cli): downlevel transform incorrectly extracting constructor parameters for nested classes (#44281) 2021-11-30 11:56:05 -05:00
extract_i18n_spec.ts test(compiler-cli): run i18n extraction tests using Ivy compiler (#43893) 2021-10-19 16:26:21 -07:00
mocks.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
ngc_spec.ts refactor: remove remaining dynamic require usages in package output (#43431) 2021-10-01 18:28:45 +00:00
perform_compile_spec.ts refactor: make all imports compatible with ESM/CJS output. (#43431) 2021-10-01 18:28:45 +00:00
perform_watch_spec.ts test(compiler-cli): run watch mode tests using Ivy compiler (#43893) 2021-10-19 16:26:21 -07:00
test_support.ts test(compiler-cli): run watch mode tests using Ivy compiler (#43893) 2021-10-19 16:26:21 -07:00
typescript_support_spec.ts fix(compiler-cli): handle pre-release versions when checking version (#44109) 2021-11-09 20:54:45 +00:00