File tree Expand file tree Collapse file tree
packages/jest-jasmine2/src/jasmine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,12 +136,14 @@ export default function SpyRegistry(options: Object) {
136136 this . _spyOnProperty = function ( obj , propertyName , accessType = 'get' ) {
137137 if ( ! obj ) {
138138 throw new Error (
139- 'spyOn could not find an object to spy upon for ' + propertyName + '' ,
139+ getErrorMsg (
140+ 'could not find an object to spy upon for ' + propertyName ,
141+ ) ,
140142 ) ;
141143 }
142144
143145 if ( ! propertyName ) {
144- throw new Error ( 'No property name supplied' ) ;
146+ throw new Error ( getErrorMsg ( 'No property name supplied' ) ) ;
145147 }
146148
147149 let descriptor ;
@@ -152,16 +154,18 @@ export default function SpyRegistry(options: Object) {
152154 }
153155
154156 if ( ! descriptor ) {
155- throw new Error ( propertyName + ' property does not exist' ) ;
157+ throw new Error ( getErrorMsg ( propertyName + ' property does not exist' ) ) ;
156158 }
157159
158160 if ( ! descriptor . configurable ) {
159- throw new Error ( propertyName + ' is not declared configurable' ) ;
161+ throw new Error ( getErrorMsg ( propertyName + ' is not declared configurable' ) ) ;
160162 }
161163
162164 if ( ! descriptor [ accessType ] ) {
163165 throw new Error (
164- 'Property ' + propertyName + ' does not have access type ' + accessType ,
166+ getErrorMsg (
167+ 'Property ' + propertyName + ' does not have access type ' + accessType ,
168+ )
165169 ) ;
166170 }
167171
You can’t perform that action at this time.
0 commit comments