From ba82532812bb975d5c272959c974a4e3bfeea621 Mon Sep 17 00:00:00 2001 From: JoostK Date: Sat, 18 Jan 2020 23:27:05 +0100 Subject: [PATCH] test(ngcc): remove usage of ES2015 syntax in ES5/UMD/CommonJS tests (#34889) This syntax is invalid in these source files and does result in compilation errors as the constructor parameters could not be resolved. This hasn't been an issue until now as those errors were ignored in the tests, but future work to introduce the Trait system of ngtsc into ngcc will cause these errors to prevent compilation, resulting in broken tests. PR Close #34889 --- .../test/rendering/commonjs_rendering_formatter_spec.ts | 8 ++++---- .../ngcc/test/rendering/esm5_rendering_formatter_spec.ts | 8 ++++---- .../ngcc/test/rendering/umd_rendering_formatter_spec.ts | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts index ad96ba569b..2071a8555e 100644 --- a/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts @@ -335,10 +335,10 @@ SOME DEFINITION TEXT ` { type: core.Directive, args: [{ selector: '[a]' }] },\n` + ` { type: OtherA }\n` + ` ];\n` + - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: core.NgZone },\n` + ` { type: core.Console }\n` + - ` ];\n` + + ` ]; };\n` + ` return SomeDirective;\n` + `}());\n` + `export {SomeDirective};`; @@ -352,10 +352,10 @@ SOME DEFINITION TEXT renderer.addAdjacentStatements(output, compiledClass, 'SOME STATEMENTS'); expect(output.toString()) .toContain( - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: core.NgZone },\n` + ` { type: core.Console }\n` + - ` ];\n` + + ` ]; };\n` + `SOME STATEMENTS\n` + ` return SomeDirective;\n`); }); diff --git a/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts index d98f4d73cc..8a4c4e0bc5 100644 --- a/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts @@ -338,10 +338,10 @@ SOME DEFINITION TEXT ` { type: Directive, args: [{ selector: '[a]' }] },\n` + ` { type: OtherA }\n` + ` ];\n` + - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: NgZone },\n` + ` { type: Console }\n` + - ` ];\n` + + ` ]; };\n` + ` return SomeDirective;\n` + `}());\n` + `export {SomeDirective};`; @@ -355,10 +355,10 @@ SOME DEFINITION TEXT renderer.addAdjacentStatements(output, compiledClass, 'SOME STATEMENTS'); expect(output.toString()) .toContain( - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: NgZone },\n` + ` { type: Console }\n` + - ` ];\n` + + ` ]; };\n` + `SOME STATEMENTS\n` + ` return SomeDirective;\n`); }); diff --git a/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts index 7d5cac130d..e56f777511 100644 --- a/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts @@ -505,10 +505,10 @@ SOME DEFINITION TEXT ` { type: core.Directive, args: [{ selector: '[a]' }] },\n` + ` { type: OtherA }\n` + ` ];\n` + - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: core.NgZone },\n` + ` { type: core.Console }\n` + - ` ];\n` + + ` ]; };\n` + ` return SomeDirective;\n` + ` }());\n` + ` exports.SomeDirective = SomeDirective;\n` + @@ -523,10 +523,10 @@ SOME DEFINITION TEXT renderer.addAdjacentStatements(output, compiledClass, 'SOME STATEMENTS'); expect(output.toString()) .toContain( - ` SomeDirective.ctorParameters = () => [\n` + + ` SomeDirective.ctorParameters = function() { return [\n` + ` { type: core.NgZone },\n` + ` { type: core.Console }\n` + - ` ];\n` + + ` ]; };\n` + `SOME STATEMENTS\n` + ` return SomeDirective;\n`); });