MCPcopy
hub / github.com/vitest-dev/vitest / getAllProperties

Function getAllProperties

packages/spy/src/index.ts:630–656  ·  view source on GitHub ↗
(original: Procedure | Constructable)

Source from the content-addressed store, hash-verified

628])
629
630function getAllProperties(original: Procedure | Constructable) {
631 const properties = new Set<string | symbol>()
632 const descriptors: Record<string | symbol, PropertyDescriptor | undefined>
633 = {}
634 while (
635 original
636 && original !== Object.prototype
637 && original !== Function.prototype
638 ) {
639 const ownProperties = [
640 ...Object.getOwnPropertyNames(original),
641 ...Object.getOwnPropertySymbols(original),
642 ]
643 for (const prop of ownProperties) {
644 if (descriptors[prop] || ignoreProperties.has(prop)) {
645 continue
646 }
647 properties.add(prop)
648 descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop)
649 }
650 original = Object.getPrototypeOf(original)
651 }
652 return {
653 properties,
654 descriptors,
655 }
656}
657
658function getDefaultConfig(original?: Procedure | Constructable): MockConfig {
659 return {

Callers 1

Calls 3

hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected