Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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://[email protected]/1337',
sampleRate: 1.0,
transport: loggingTransport,
integrations: [Sentry.featureFlagsIntegration()],
integrations: [flagsIntegration],
});

const flagsIntegration = Sentry.getClient()?.getIntegrationByName<Sentry.FeatureFlagsIntegration>('FeatureFlags');
flagsIntegration?.addFeatureFlag('shared', true);
async function run(): Promise<void> {
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();
Loading