diff --git a/dev-packages/node-integration-tests/suites/featureFlags/featureFlagsIntegration/onError/withScope/scenario.ts b/dev-packages/node-integration-tests/suites/featureFlags/featureFlagsIntegration/onError/withScope/scenario.ts index b6537011a87f..4ba9d63b9733 100644 --- a/dev-packages/node-integration-tests/suites/featureFlags/featureFlagsIntegration/onError/withScope/scenario.ts +++ b/dev-packages/node-integration-tests/suites/featureFlags/featureFlagsIntegration/onError/withScope/scenario.ts @@ -1,22 +1,30 @@ -import type { Scope } from '@sentry/node'; import * as Sentry from '@sentry/node'; import { loggingTransport } from '@sentry-internal/node-integration-tests'; +const flagsIntegration = Sentry.featureFlagsIntegration(); + Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', sampleRate: 1.0, transport: loggingTransport, - integrations: [Sentry.featureFlagsIntegration()], + integrations: [flagsIntegration], }); -const flagsIntegration = Sentry.getClient()?.getIntegrationByName('FeatureFlags'); -flagsIntegration?.addFeatureFlag('shared', true); +async function run(): Promise { + flagsIntegration.addFeatureFlag('shared', true); -Sentry.withScope((_scope: Scope) => { - flagsIntegration?.addFeatureFlag('forked', true); - flagsIntegration?.addFeatureFlag('shared', false); - Sentry.captureException(new Error('Error in forked scope')); -}); + Sentry.withScope(() => { + flagsIntegration.addFeatureFlag('forked', true); + flagsIntegration.addFeatureFlag('shared', false); + Sentry.captureException(new Error('Error in forked scope')); + }); + + await Sentry.flush(); + + flagsIntegration.addFeatureFlag('main', true); + + throw new Error('Error in main scope'); +} -flagsIntegration?.addFeatureFlag('main', true); -throw new Error('Error in main scope'); +// eslint-disable-next-line @typescript-eslint/no-floating-promises +run();