Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

fix(@angular-devkit/build-optimizer): don't exceed call stack with bi… #998

Merged
merged 1 commit into from Jun 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_optimizer/package.json
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"loader-utils": "^1.1.0",
"source-map": "^0.5.6",
"typescript": "~2.7.2",
"typescript": "~2.9.1",
"webpack-sources": "^1.1.0"
}
}
Expand Up @@ -8,6 +8,7 @@
// tslint:disable-next-line:no-implicit-dependencies
import { tags } from '@angular-devkit/core';
import { RawSourceMap } from 'source-map';
import { TransformJavascriptOutput } from '../helpers/transform-javascript';
import { buildOptimizer } from './build-optimizer';


Expand Down Expand Up @@ -127,6 +128,32 @@ describe('build-optimizer', () => {

expect(() => buildOptimizer({ content: input, strict: true })).toThrow();
});

// TODO: re-enable this test when updating to TypeScript >2.9.1.
// The `prefix-classes` tests will also need to be adjusted.
// See https://github.com/angular/devkit/pull/998#issuecomment-393867606 for more info.
xit(`doesn't exceed call stack size when type checking very big classes`, () => {
// BigClass with a thousand methods.
// Clazz is included with ctorParameters to trigger transforms with type checking.
const input = `
var BigClass = /** @class */ (function () {
function BigClass() {
}
${Array.from(new Array(1000)).map((_v, i) =>
`BigClass.prototype.method${i} = function () { return this.myVar; };`,
).join('\n')}
return BigClass;
}());
${clazz}
Clazz.ctorParameters = function () { return []; };
`;

let boOutput: TransformJavascriptOutput;
expect(() => {
boOutput = buildOptimizer({ content: input });
expect(boOutput.emitSkipped).toEqual(false);
}).not.toThrow();
});
});

describe('whitelisted modules', () => {
Expand Down