@hirez_io/auto-spies-core
Advanced tools
Comparing version 1.6.1 to 1.6.2
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.6.2](https://github.com/hirezio/auto-spies/compare/@hirez_io/auto-spies-core@1.6.1...@hirez_io/auto-spies-core@1.6.2) (2021-02-04) | ||
### Bug Fixes | ||
* **auto-spies-core:** don't add getters to method names when creating spies from class ([41e43c7](https://github.com/hirezio/auto-spies/commit/41e43c76d4b494ec7e57cdc075ef0339c69435db)), closes [#40](https://github.com/hirezio/auto-spies/issues/40) | ||
## [1.6.1](https://github.com/hirezio/auto-spies/compare/@hirez_io/auto-spies-core@1.6.0...@hirez_io/auto-spies-core@1.6.1) (2021-01-18) | ||
@@ -8,0 +19,0 @@ |
@@ -70,13 +70,18 @@ "use strict"; | ||
if (parentObj) { | ||
methods = methods.concat(Object.getOwnPropertyNames(obj)); | ||
methods = methods.concat(extractMethodsFromObject(obj)); | ||
} | ||
obj = parentObj; | ||
} | ||
var constructorIndex = methods.indexOf('constructor'); | ||
/* istanbul ignore else */ | ||
if (constructorIndex >= 0) { | ||
methods.splice(constructorIndex, 1); | ||
} | ||
return methods; | ||
} | ||
function extractMethodsFromObject(obj) { | ||
var propertyDescriptors = Object.getOwnPropertyDescriptors(obj); | ||
return Object.keys(propertyDescriptors).reduce(function (names, name) { | ||
var descriptor = propertyDescriptors[name]; | ||
if (name !== 'constructor' && !descriptor.get) { | ||
names.push(name); | ||
} | ||
return names; | ||
}, []); | ||
} | ||
//# sourceMappingURL=create-auto-spy-from-class.js.map |
{ | ||
"name": "@hirez_io/auto-spies-core", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"publishConfig": { | ||
@@ -58,3 +58,3 @@ "access": "public" | ||
}, | ||
"gitHead": "365f64f2a76e9983f0460452637957831740139c" | ||
"gitHead": "56c447c7f517d4f6de95e073cc42fa56f7e7638c" | ||
} |
@@ -88,14 +88,18 @@ import { | ||
if (parentObj) { | ||
methods = methods.concat(Object.getOwnPropertyNames(obj)); | ||
methods = methods.concat(extractMethodsFromObject(obj)); | ||
} | ||
obj = parentObj; | ||
} | ||
const constructorIndex = methods.indexOf('constructor'); | ||
/* istanbul ignore else */ | ||
if (constructorIndex >= 0) { | ||
methods.splice(constructorIndex, 1); | ||
} | ||
return methods; | ||
} | ||
function extractMethodsFromObject(obj: any) { | ||
const propertyDescriptors = Object.getOwnPropertyDescriptors(obj); | ||
return Object.keys(propertyDescriptors).reduce((names, name) => { | ||
const descriptor = propertyDescriptors[name]; | ||
if (name !== 'constructor' && !descriptor.get) { | ||
names.push(name); | ||
} | ||
return names; | ||
}, [] as string[]); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
282119
1668