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

nestjs / nest / f21074a3-8fcf-4ec1-a93c-75675d264f01

22 Oct 2025 12:34AM UTC coverage: 88.726% (-0.2%) from 88.888%
f21074a3-8fcf-4ec1-a93c-75675d264f01

Pull #15815

circleci

mag123c
test(core): add nested transient isolation integration test
Pull Request #15815: fix(core): ensure nested transient provider isolation

2742 of 3477 branches covered (78.86%)

7 of 7 new or added lines in 1 file covered. (100.0%)

52 existing lines in 5 files now uncovered.

7280 of 8205 relevant lines covered (88.73%)

17.3 hits per line

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

95.24
/packages/websockets/gateway-metadata-explorer.ts
1
import { isFunction, isUndefined } from '@nestjs/common/utils/shared.utils';
1✔
2
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
3
import { Observable } from 'rxjs';
4
import {
1✔
5
  GATEWAY_SERVER_METADATA,
6
  MESSAGE_MAPPING_METADATA,
7
  MESSAGE_METADATA,
8
} from './constants';
9
import { NestGateway } from './interfaces/nest-gateway.interface';
10

11
export interface MessageMappingProperties {
12
  message: any;
13
  methodName: string;
14
  callback: (...args: any[]) => Observable<any> | Promise<any>;
15
}
16

17
export class GatewayMetadataExplorer {
1✔
18
  constructor(private readonly metadataScanner: MetadataScanner) {}
34✔
19

20
  public explore(instance: NestGateway): MessageMappingProperties[] {
21
    const instancePrototype = Object.getPrototypeOf(instance);
1✔
22
    return this.metadataScanner
1✔
23
      .getAllMethodNames(instancePrototype)
24
      .map(method => this.exploreMethodMetadata(instancePrototype, method)!)
3✔
25
      .filter(metadata => metadata);
3✔
26
  }
27

28
  public exploreMethodMetadata(
29
    instancePrototype: object,
30
    methodName: string,
31
  ): MessageMappingProperties | null {
32
    const callback = instancePrototype[methodName];
5✔
33
    const isMessageMapping = Reflect.getMetadata(
5✔
34
      MESSAGE_MAPPING_METADATA,
35
      callback,
36
    );
37
    if (isUndefined(isMessageMapping)) {
5✔
38
      return null;
2✔
39
    }
40
    const message = Reflect.getMetadata(MESSAGE_METADATA, callback);
3✔
41
    return {
3✔
42
      callback,
43
      message,
44
      methodName,
45
    };
46
  }
47

48
  public *scanForServerHooks(instance: NestGateway): IterableIterator<string> {
49
    for (const propertyKey in instance) {
1✔
50
      if (isFunction(propertyKey)) {
2!
UNCOV
51
        continue;
×
52
      }
53
      const property = String(propertyKey);
2✔
54
      const isServer = Reflect.getMetadata(
2✔
55
        GATEWAY_SERVER_METADATA,
56
        instance,
57
        property,
58
      );
59
      if (!isUndefined(isServer)) {
2!
60
        yield property;
2✔
61
      }
62
    }
63
  }
64
}
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

© 2025 Coveralls, Inc