Skip to content

Commit fae120b

Browse files
committed
Fix formatting (yarn run biome check --apply)
1 parent 776bb58 commit fae120b

File tree

4 files changed

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

4 files changed

+31
-19
lines changed

dev-packages/browser-integration-tests/suites/integrations/featureFlags/unleash/badSignature/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ window.UnleashClient = class {
77
};
88

99
window.Sentry = Sentry;
10-
window.sentryUnleashIntegration = Sentry.unleashIntegration({unleashClientClass: window.UnleashClient});
10+
window.sentryUnleashIntegration = Sentry.unleashIntegration({ unleashClientClass: window.UnleashClient });
1111

1212
Sentry.init({
1313
dsn: 'https://[email protected]/1337',

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,15 @@ sentryTest('Logs and returns if isEnabled does not match expected signature', as
4141
// Expected error logs.
4242
expect(errorLogs).toEqual(
4343
expect.arrayContaining([
44-
expect.stringContaining('[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: my-feature (string), result: my-feature (string)'),
45-
expect.stringContaining('[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: 999 (number), result: 999 (number)'),
46-
expect.stringContaining('[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: [object Object] (object), result: [object Object] (object)'),
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+
),
4753
]),
4854
);
4955
});

dev-packages/browser-integration-tests/suites/integrations/featureFlags/unleash/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ window.UnleashClient = class {
4141
};
4242

4343
window.Sentry = Sentry;
44-
window.sentryUnleashIntegration = Sentry.unleashIntegration({unleashClientClass: window.UnleashClient});
44+
window.sentryUnleashIntegration = Sentry.unleashIntegration({ unleashClientClass: window.UnleashClient });
4545

4646
Sentry.init({
4747
dsn: 'https://[email protected]/1337',

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,22 @@ import type { UnleashClient, UnleashClientClass } from './types';
2929
* Sentry.captureException(new Error('something went wrong'));
3030
* ```
3131
*/
32-
export const unleashIntegration = defineIntegration(({unleashClientClass}: {unleashClientClass: UnleashClientClass}) => {
33-
return {
34-
name: 'Unleash',
32+
export const unleashIntegration = defineIntegration(
33+
({ unleashClientClass }: { unleashClientClass: UnleashClientClass }) => {
34+
return {
35+
name: 'Unleash',
3536

36-
processEvent(event: Event, _hint: EventHint, _client: Client): Event {
37-
return copyFlagsFromScopeToEvent(event);
38-
},
37+
processEvent(event: Event, _hint: EventHint, _client: Client): Event {
38+
return copyFlagsFromScopeToEvent(event);
39+
},
3940

40-
setupOnce() {
41-
const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;
42-
fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);
43-
},
44-
};
45-
}) satisfies IntegrationFn;
41+
setupOnce() {
42+
const unleashClientPrototype = unleashClientClass.prototype as UnleashClient;
43+
fill(unleashClientPrototype, 'isEnabled', _wrappedIsEnabled);
44+
},
45+
};
46+
},
47+
) satisfies IntegrationFn;
4648

4749
/**
4850
* Wraps the UnleashClient.isEnabled method to capture feature flag evaluations. Its only side effect is writing to Sentry scope.
@@ -53,15 +55,19 @@ export const unleashIntegration = defineIntegration(({unleashClientClass}: {unle
5355
* @param original - The original method.
5456
* @returns Wrapped method. Results should match the original.
5557
*/
56-
function _wrappedIsEnabled(original: (this: UnleashClient, ...args: unknown[]) => unknown): (this: UnleashClient, ...args: unknown[]) => unknown {
58+
function _wrappedIsEnabled(
59+
original: (this: UnleashClient, ...args: unknown[]) => unknown,
60+
): (this: UnleashClient, ...args: unknown[]) => unknown {
5761
return function (this: UnleashClient, ...args: unknown[]): unknown {
5862
const toggleName = args[0];
5963
const result = original.apply(this, args);
6064

6165
if (typeof toggleName === 'string' && typeof result === 'boolean') {
6266
insertFlagToScope(toggleName, result);
6367
} else {
64-
logger.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`);
68+
logger.error(
69+
`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${toggleName} (${typeof toggleName}), result: ${result} (${typeof result})`,
70+
);
6571
}
6672
return result;
6773
};

0 commit comments

Comments
 (0)