Skip to content

Commit

Permalink
fix: es2015 class declaration method mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jsantha authored and ike18t committed Jun 29, 2019
1 parent 315ee2a commit 1286b10
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/mock-component/mock-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function MockComponent<TComponent>(component: Type<TComponent>, metaData?
@MockOf(component)
class ComponentMock implements ControlValueAccessor {
constructor(changeDetector: ChangeDetectorRef) {
Object.keys(component.prototype).forEach((method) => {
Object.getOwnPropertyNames(component.prototype).forEach((method) => {
if (!(this as any)[method]) {
(this as any)[method] = () => {};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/mock-directive/mock-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function MockDirective<TDirective>(directive: Type<TDirective>): Type<Moc
(this as any).__viewContainer = viewContainer;
(this as any).__isStructural = template && viewContainer;

Object.keys(directive.prototype).forEach((method) => {
Object.getOwnPropertyNames(directive.prototype).forEach((method) => {
if (!(this as any)[method]) {
(this as any)[method] = () => {};
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"lib": ["es2016", "dom"],
"module": "commonjs",
"target": "es5",
"target": "es2015",
"noImplicitAny": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
Expand Down

1 comment on commit 1286b10

@sapachev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsantha thanks for fix it!
@ike18t can you publish a new version of the module?

Please sign in to comment.