|
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 |
|
@@ -145,6 +146,32 @@ describe('build-optimizer', () => {
|
145 | 146 |
|
146 | 147 | expect(() => buildOptimizer({ content: input, strict: true })).toThrow();
|
147 | 148 | });
|
| 149 | + |
| 150 | + // TODO: re-enable this test when updating to TypeScript >2.9.1. |
| 151 | + // The `prefix-classes` tests will also need to be adjusted. |
| 152 | + // See https://github.com/angular/devkit/pull/998#issuecomment-393867606 for more info. |
| 153 | + xit(`doesn't exceed call stack size when type checking very big classes`, () => { |
| 154 | + // BigClass with a thousand methods. |
| 155 | + // Clazz is included with ctorParameters to trigger transforms with type checking. |
| 156 | + const input = ` |
| 157 | + var BigClass = /** @class */ (function () { |
| 158 | + function BigClass() { |
| 159 | + } |
| 160 | + ${Array.from(new Array(1000)).map((_v, i) => |
| 161 | + `BigClass.prototype.method${i} = function () { return this.myVar; };`, |
| 162 | + ).join('\n')} |
| 163 | + return BigClass; |
| 164 | + }()); |
| 165 | + ${clazz} |
| 166 | + Clazz.ctorParameters = function () { return []; }; |
| 167 | + `; |
| 168 | + |
| 169 | + let boOutput: TransformJavascriptOutput; |
| 170 | + expect(() => { |
| 171 | + boOutput = buildOptimizer({ content: input }); |
| 172 | + expect(boOutput.emitSkipped).toEqual(false); |
| 173 | + }).not.toThrow(); |
| 174 | + }); |
148 | 175 | });
|
149 | 176 |
|
150 | 177 | describe('whitelisted modules', () => {
|
|
0 commit comments