node-sdk.testing.ts 558 B

123456789101112131415161718192021222324
  1. /**
  2. * This module provides testing APIs for node-sdk.ts
  3. * It should be imported only in test files
  4. */
  5. import type { NodeSDK } from '@opentelemetry/sdk-node';
  6. import { __testing__ } from './node-sdk';
  7. /**
  8. * Get the current SDK instance
  9. * This function should only be used in tests
  10. */
  11. export const getSdkInstance = (): NodeSDK | undefined => {
  12. return __testing__.getSdkInstance();
  13. };
  14. /**
  15. * Reset the SDK instance
  16. * This function should be used to clean up between tests
  17. */
  18. export const resetSdkInstance = (): void => {
  19. __testing__.reset();
  20. };