Skip to content

Commit bcc0b86

Browse files
committed
Only log/test if debug build
1 parent 6160f07 commit bcc0b86

File tree

2 files changed

+19
-14
lines changed
  • dev-packages/browser-integration-tests/suites/integrations/featureFlags/unleash/badSignature
  • packages/browser/src/integrations/featureFlags/unleash

2 files changed

+19
-14
lines changed

dev-packages/browser-integration-tests/suites/integrations/featureFlags/unleash/badSignature/test.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ sentryTest('Logs and returns if isEnabled does not match expected signature', as
88
if (shouldSkipFeatureFlagsTest()) {
99
sentryTest.skip();
1010
}
11+
const bundleKey = process.env.PW_BUNDLE || '';
12+
const hasDebug = !bundleKey.includes('_min');
1113

1214
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
1315
return route.fulfill({
@@ -39,17 +41,19 @@ sentryTest('Logs and returns if isEnabled does not match expected signature', as
3941
expect(results).toEqual(['my-feature', 999, {}]);
4042

4143
// Expected error logs.
42-
expect(errorLogs).toEqual(
43-
expect.arrayContaining([
44-
expect.stringContaining(
45-
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: my-feature (string), result: my-feature (string)',
46-
),
47-
expect.stringContaining(
48-
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: 999 (number), result: 999 (number)',
49-
),
50-
expect.stringContaining(
51-
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: [object Object] (object), result: [object Object] (object)',
52-
),
53-
]),
54-
);
44+
if (hasDebug) {
45+
expect(errorLogs).toEqual(
46+
expect.arrayContaining([
47+
expect.stringContaining(
48+
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: my-feature (string), result: my-feature (string)',
49+
),
50+
expect.stringContaining(
51+
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: 999 (number), result: 999 (number)',
52+
),
53+
expect.stringContaining(
54+
'[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: [object Object] (object), result: [object Object] (object)',
55+
),
56+
]),
57+
);
58+
}
5559
});

packages/browser/src/integrations/featureFlags/unleash/integration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Client, Event, EventHint, IntegrationFn } from '@sentry/core';
22

33
import { defineIntegration, fill, logger } from '@sentry/core';
4+
import { DEBUG_BUILD } from '../../../debug-build';
45
import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags';
56
import type { UnleashClient, UnleashClientClass } from './types';
67

@@ -64,7 +65,7 @@ function _wrappedIsEnabled(
6465

6566
if (typeof toggleName === 'string' && typeof result === 'boolean') {
6667
insertFlagToScope(toggleName, result);
67-
} else {
68+
} else if (DEBUG_BUILD) {
6869
logger.error(
6970
`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,
7071
);

0 commit comments

Comments
 (0)