diff --git a/code/lib/telemetry/src/storybook-metadata.test.ts b/code/lib/telemetry/src/storybook-metadata.test.ts index ab64dc26e9a1..83a206a92761 100644 --- a/code/lib/telemetry/src/storybook-metadata.test.ts +++ b/code/lib/telemetry/src/storybook-metadata.test.ts @@ -349,6 +349,33 @@ describe('storybook-metadata', () => { expect(res.refCount).toEqual(2); }); + test('only reports addon options for addon-essentials', async () => { + const res = await computeStorybookMetadata({ + packageJson: packageJsonMock, + mainConfig: { + ...mainJsMock, + addons: [ + { name: '@storybook/addon-essentials', options: { controls: false } }, + { name: 'addon-foo', options: { foo: 'bar' } }, + ], + }, + }); + expect(res.addons).toMatchInlineSnapshot(` + Object { + "@storybook/addon-essentials": Object { + "options": Object { + "controls": false, + }, + "version": "x.x.x", + }, + "addon-foo": Object { + "options": undefined, + "version": "x.x.x", + }, + } + `); + }); + test.each(Object.entries(metaFrameworks))( 'should detect the supported metaframework: %s', async (metaFramework, name) => { diff --git a/code/lib/telemetry/src/storybook-metadata.ts b/code/lib/telemetry/src/storybook-metadata.ts index 01a54d9c9ec0..2c70b566f97d 100644 --- a/code/lib/telemetry/src/storybook-metadata.ts +++ b/code/lib/telemetry/src/storybook-metadata.ts @@ -114,7 +114,9 @@ export const computeStorybookMetadata = async ({ if (typeof addon === 'string') { addonName = sanitizeAddonName(addon); } else { - options = addon.options; + if (addon.name.includes('addon-essentials')) { + options = addon.options; + } addonName = sanitizeAddonName(addon.name); }