• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snatalenko / node-cqrs / 14002510880

21 Mar 2025 11:15PM UTC coverage: 82.347% (-12.1%) from 94.436%
14002510880

push

github

snatalenko
1.0.0-rc.6

450 of 731 branches covered (61.56%)

877 of 1065 relevant lines covered (82.35%)

21.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/src/utils/getMessageHandlerNames.ts
1
function getInheritedPropertyNames(prototype: object): string[] {
2
        const parentPrototype = prototype && Object.getPrototypeOf(prototype);
72✔
3
        if (!parentPrototype)
72✔
4
                return [];
24✔
5

6
        const propDescriptors = Object.getOwnPropertyDescriptors(parentPrototype);
48✔
7
        const propNames = Object.keys(propDescriptors);
48✔
8

9
        return [
48✔
10
                ...propNames,
11
                ...getInheritedPropertyNames(parentPrototype)
12
        ];
13
}
14

15
/**
16
 * Get message handler names from a command/event handler class.
17
 * Assumes all private method names start from underscore ("_").
18
 */
19
export function getMessageHandlerNames(observerInstanceOrClass: (object | Function)): string[] {
24✔
20
        if (!observerInstanceOrClass)
24!
21
                throw new TypeError('observerInstanceOrClass argument required');
×
22

23
        const prototype = typeof observerInstanceOrClass === 'function' ?
24!
24
                observerInstanceOrClass.prototype :
25
                Object.getPrototypeOf(observerInstanceOrClass);
26

27
        if (!prototype)
24!
28
                throw new TypeError('prototype cannot be resolved');
×
29

30
        const inheritedProperties = getInheritedPropertyNames(prototype);
24✔
31
        const propDescriptors = Object.getOwnPropertyDescriptors(prototype);
24✔
32
        const propNames = Object.keys(propDescriptors);
24✔
33

34
        return propNames.filter(key =>
24✔
35
                !key.startsWith('_') &&
64✔
36
                !inheritedProperties.includes(key) &&
37
                typeof propDescriptors[key].value === 'function');
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc