File tree 2 files changed +6
-11
lines changed
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -555,7 +555,7 @@ declare var expect: {
555
555
// TODO handle return type
556
556
// http://jasmine.github.io/2.4/introduction.html#section-Spies
557
557
declare function spyOn ( value : mixed , method : string ) : Object ;
558
- declare function spyOnProperty ( value : mixed , propertyName : string , accessType : 'get' | 'set' ) : Object ;
558
+ declare function spyOnProperty ( value : mixed , propertyName : string , accessType : string ) : Object ;
559
559
560
560
/** Holds all functions related to manipulating test runner */
561
561
declare var jest : JestObjectType ;
Original file line number Diff line number Diff line change @@ -691,10 +691,10 @@ class ModuleMockerClass {
691
691
return object [ methodName ] ;
692
692
}
693
693
694
- spyOnProperty ( object : any , propertyName : any , accessType = 'get' ) : any {
695
- if ( typeof object !== 'object' && typeof object !== 'function' ) {
694
+ spyOnProperty ( obj : any , propertyName : any , accessType : string = 'get' ) : any {
695
+ if ( typeof obj !== 'object' && typeof obj !== 'function' ) {
696
696
throw new Error (
697
- 'Cannot spyOn on a primitive value; ' + this . _typeOf ( object ) + ' given' ,
697
+ 'Cannot spyOn on a primitive value; ' + this . _typeOf ( obj ) + ' given' ,
698
698
) ;
699
699
}
700
700
@@ -706,12 +706,7 @@ class ModuleMockerClass {
706
706
throw new Error ( 'No property name supplied' ) ;
707
707
}
708
708
709
- let descriptor ;
710
- try {
711
- descriptor = Object . getOwnPropertyDescriptor ( obj , propertyName ) ;
712
- } catch ( e ) {
713
- // IE 8 doesn't support `definePropery` on non-DOM nodes
714
- }
709
+ const descriptor = Object . getOwnPropertyDescriptor ( obj , propertyName ) ;
715
710
716
711
if ( ! descriptor ) {
717
712
throw new Error ( propertyName + ' property does not exist' ) ;
@@ -731,7 +726,7 @@ class ModuleMockerClass {
731
726
if ( typeof original !== 'function' ) {
732
727
throw new Error (
733
728
'Cannot spy the ' +
734
- methodName +
729
+ propertyName +
735
730
' property because it is not a function; ' +
736
731
this . _typeOf ( original ) +
737
732
' given instead' ,
You can’t perform that action at this time.
0 commit comments