|
1 |
| -import type { Scope } from '@sentry/node'; |
2 | 1 | import * as Sentry from '@sentry/node';
|
3 | 2 | import { loggingTransport } from '@sentry-internal/node-integration-tests';
|
4 | 3 |
|
| 4 | +const flagsIntegration = Sentry.featureFlagsIntegration(); |
| 5 | + |
5 | 6 | Sentry.init({
|
6 | 7 | dsn: 'https://[email protected]/1337',
|
7 | 8 | sampleRate: 1.0,
|
8 | 9 | transport: loggingTransport,
|
9 |
| - integrations: [Sentry.featureFlagsIntegration()], |
| 10 | + integrations: [flagsIntegration], |
10 | 11 | });
|
11 | 12 |
|
12 |
| -const flagsIntegration = Sentry.getClient()?.getIntegrationByName<Sentry.FeatureFlagsIntegration>('FeatureFlags'); |
13 |
| -flagsIntegration?.addFeatureFlag('shared', true); |
| 13 | +async function run(): Promise<void> { |
| 14 | + flagsIntegration.addFeatureFlag('shared', true); |
14 | 15 |
|
15 |
| -Sentry.withScope((_scope: Scope) => { |
16 |
| - flagsIntegration?.addFeatureFlag('forked', true); |
17 |
| - flagsIntegration?.addFeatureFlag('shared', false); |
18 |
| - Sentry.captureException(new Error('Error in forked scope')); |
19 |
| -}); |
| 16 | + Sentry.withScope(() => { |
| 17 | + flagsIntegration.addFeatureFlag('forked', true); |
| 18 | + flagsIntegration.addFeatureFlag('shared', false); |
| 19 | + Sentry.captureException(new Error('Error in forked scope')); |
| 20 | + }); |
| 21 | + |
| 22 | + await Sentry.flush(); |
| 23 | + |
| 24 | + flagsIntegration.addFeatureFlag('main', true); |
| 25 | + |
| 26 | + throw new Error('Error in main scope'); |
| 27 | +} |
20 | 28 |
|
21 |
| -flagsIntegration?.addFeatureFlag('main', true); |
22 |
| -throw new Error('Error in main scope'); |
| 29 | +// eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 30 | +run(); |
0 commit comments