|
8 | 8 | // tslint:disable-next-line:no-implicit-dependencies
|
9 | 9 | import { tags } from '@angular-devkit/core';
|
10 | 10 | import { RawSourceMap } from 'source-map';
|
| 11 | +import { TransformJavascriptOutput } from '../helpers/transform-javascript'; |
11 | 12 | import { buildOptimizer } from './build-optimizer';
|
12 | 13 |
|
13 | 14 |
|
@@ -127,6 +128,32 @@ describe('build-optimizer', () => {
|
127 | 128 |
|
128 | 129 | expect(() => buildOptimizer({ content: input, strict: true })).toThrow();
|
129 | 130 | });
|
| 131 | + |
| 132 | + // TODO: re-enable this test when updating to TypeScript >2.9.1. |
| 133 | + // The `prefix-classes` tests will also need to be adjusted. |
| 134 | + // See https://github.com/angular/devkit/pull/998#issuecomment-393867606 for more info. |
| 135 | + xit(`doesn't exceed call stack size when type checking very big classes`, () => { |
| 136 | + // BigClass with a thousand methods. |
| 137 | + // Clazz is included with ctorParameters to trigger transforms with type checking. |
| 138 | + const input = ` |
| 139 | + var BigClass = /** @class */ (function () { |
| 140 | + function BigClass() { |
| 141 | + } |
| 142 | + ${Array.from(new Array(1000)).map((_v, i) => |
| 143 | + `BigClass.prototype.method${i} = function () { return this.myVar; };`, |
| 144 | + ).join('\n')} |
| 145 | + return BigClass; |
| 146 | + }()); |
| 147 | + ${clazz} |
| 148 | + Clazz.ctorParameters = function () { return []; }; |
| 149 | + `; |
| 150 | + |
| 151 | + let boOutput: TransformJavascriptOutput; |
| 152 | + expect(() => { |
| 153 | + boOutput = buildOptimizer({ content: input }); |
| 154 | + expect(boOutput.emitSkipped).toEqual(false); |
| 155 | + }).not.toThrow(); |
| 156 | + }); |
130 | 157 | });
|
131 | 158 |
|
132 | 159 | describe('whitelisted modules', () => {
|
|
0 commit comments